leave port_security_enabled undefined by default 57/38257/1
authorRoss Brattain <ross.b.brattain@intel.com>
Thu, 27 Jul 2017 07:36:52 +0000 (00:36 -0700)
committerRoss Brattain <ross.b.brattain@intel.com>
Thu, 27 Jul 2017 07:36:52 +0000 (00:36 -0700)
some deployments don't have port security ML2 plugin enabled,
so we have to leave port security undefined by default

RuntimeError: Resource CREATE failed:
 BadRequest: resources.yardstick-TC072-19be2f60-test: Unrecognized attribute(s) 'port_security_enabled'
https://build.opnfv.org/ci/user/narindergupta/my-views/view/joid/job/yardstick-joid-baremetal-daily-master/1276/console

Change-Id: I69178f869f6215f42d90ea4cfb297dad3d799f83
Signed-off-by: Ross Brattain <ross.b.brattain@intel.com>
yardstick/benchmark/contexts/model.py
yardstick/orchestrator/heat.py

index 6601ecf..ec47432 100644 (file)
@@ -110,7 +110,7 @@ class Network(Object):
         self.provider = attrs.get('provider')
         self.segmentation_id = attrs.get('segmentation_id')
         self.network_type = attrs.get('network_type')
-        self.port_security_enabled = attrs.get('port_security_enabled', True)
+        self.port_security_enabled = attrs.get('port_security_enabled')
         self.allowed_address_pairs = attrs.get('allowed_address_pairs', [])
         try:
             # we require 'null' or '' to disable setting gateway_ip
index 57b23d3..95ca0ad 100644 (file)
@@ -231,7 +231,7 @@ name (i.e. %s).\
         }
 
     def add_network(self, name, physical_network='physnet1', provider=None,
-                    segmentation_id=None, port_security_enabled=True):
+                    segmentation_id=None, port_security_enabled=None):
         """add to the template a Neutron Net"""
         log.debug("adding Neutron::Net '%s'", name)
         if provider is None:
@@ -239,7 +239,6 @@ name (i.e. %s).\
                 'type': 'OS::Neutron::Net',
                 'properties': {
                     'name': name,
-                    'port_security_enabled': port_security_enabled,
                 }
             }
         else:
@@ -249,11 +248,14 @@ name (i.e. %s).\
                     'name': name,
                     'network_type': 'vlan',
                     'physical_network': physical_network,
-                    'port_security_enabled': port_security_enabled,
                 },
             }
             if segmentation_id:
                 self.resources[name]['properties']['segmentation_id'] = segmentation_id
+        # if port security is not defined then don't add to template:
+        # some deployments don't have port security plugin installed
+        if port_security_enabled is not None:
+            self.resources[name]['properties']['port_security_enabled'] = port_security_enabled
 
     def add_server_group(self, name, policies):     # pragma: no cover
         """add to the template a ServerGroup"""