From a8ed4ad3d345187bb314c7c574a1476de1a16584 Mon Sep 17 00:00:00 2001 From: Gary Kotton Date: Thu, 19 Feb 2015 05:55:14 -0800 Subject: [PATCH] VMware: Router Type Extension Support Provide a router type extension. This will enable defining the type of edge appliance. That is, an exclusive edge or a shared edge for routing services. DocImpact Change-Id: I1464d0390c0b3ee7658e7955e6433f2ac078a5fe --- .../plugins/vmware/extensions/routertype.py | 64 +++++++++++++++++++ 1 file changed, 64 insertions(+) create mode 100644 neutron/plugins/vmware/extensions/routertype.py diff --git a/neutron/plugins/vmware/extensions/routertype.py b/neutron/plugins/vmware/extensions/routertype.py new file mode 100644 index 000000000..ba7c831a2 --- /dev/null +++ b/neutron/plugins/vmware/extensions/routertype.py @@ -0,0 +1,64 @@ +# Copyright 2015 VMware, Inc. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); you may +# not use this file except in compliance with the License. You may obtain +# a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations +# under the License. + +from neutron.api.v2 import attributes + + +ROUTER_TYPE = 'router_type' +EXTENDED_ATTRIBUTES_2_0 = { + 'routers': { + ROUTER_TYPE: {'allow_post': True, 'allow_put': False, + 'validate': {'type:values': ['shared', 'exclusive']}, + 'default': attributes.ATTR_NOT_SPECIFIED, + 'is_visible': True}, + } +} + + +class Routertype(object): + """Extension class supporting router type.""" + + @classmethod + def get_name(cls): + return "Router Type" + + @classmethod + def get_alias(cls): + return "nsxv-router-type" + + @classmethod + def get_description(cls): + return "Enables configuration of NSXv router type." + + @classmethod + def get_namespace(cls): + return "http://docs.openstack.org/ext/router-type/api/v1.0" + + @classmethod + def get_updated(cls): + return "2015-1-12T10:00:00-00:00" + + def get_required_extensions(self): + return ["router"] + + @classmethod + def get_resources(cls): + """Returns Ext Resources.""" + return [] + + def get_extended_resources(self, version): + if version == "2.0": + return EXTENDED_ATTRIBUTES_2_0 + else: + return {} -- 2.45.2