Bug 138 69/1169/1
authorPhilip Joseph <philip.joseph@riftio.com>
Thu, 29 Dec 2016 14:37:22 +0000 (09:37 -0500)
committerPhilip Joseph <philip.joseph@riftio.com>
Thu, 23 Feb 2017 14:19:23 +0000 (19:49 +0530)
* Support enabling/disabling port security feature on VDU
* Openstack changes to support port enabling/disabling

Fix by: Hashir Mohammed <hashir.mohammed@riftio.com>

Signed-off-by: Philip Joseph <philip.joseph@riftio.com>
models/plugins/yang/vnfd.yang
rwcal/plugins/vala/rwcal_openstack/rift/rwcal/openstack/openstack_drv.py
rwcal/plugins/vala/rwcal_openstack/rwcal_openstack.py
rwlaunchpad/plugins/rwnsm/rift/tasklets/rwnsmtasklet/rwnsmtasklet.py
rwlaunchpad/plugins/rwvnfm/rift/tasklets/rwvnfmtasklet/rwvnfmtasklet.py

index 27adfbc..fb1bd03 100644 (file)
@@ -70,6 +70,7 @@ module vnfd
     leaf port-security-enabled {
       description "Enables the port security for the port";
       type boolean;
+      default true;
     }
   }
 
@@ -319,7 +320,7 @@ module vnfd
                 "Use the default management interface on this VDU.";
             leaf vdu-id {
               type leafref {
-                path "../../vdu/id";
+                path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:vdu/vnfd:id";
               }
             }
           }
@@ -329,7 +330,7 @@ module vnfd
                 "Use the ip address associated with this connection point.";
             leaf cp {
               type leafref {
-                path "../../connection-point/name";
+                path "/vnfd:vnfd-catalog/vnfd:vnfd/vnfd:connection-point/vnfd:name";
               }
             }
           }
index 191a06f..3e38478 100644 (file)
@@ -1449,9 +1449,8 @@ class NeutronDriver(object):
                 "name"              : kwargs['name'],
                 "network_id"        : kwargs['network_id'],
                 "fixed_ips"         : [ {"subnet_id": kwargs['subnet_id']}],
-                "binding:vnic_type" : kwargs['port_type']}}
-        if 'port_security_enabled' in kwargs:
-            params["port"]["port_security_enabled"] = kwargs['port_security_enabled']
+                "binding:vnic_type" : kwargs['port_type'],
+                "port_security_enabled" : kwargs['port_security_enabled']}}
 
         ntconn = self._get_neutron_connection()
         try:
index 2be896a..b685f19 100644 (file)
@@ -1500,8 +1500,10 @@ class RwcalOpenstackPlugin(GObject.Object, RwCal.Cloud):
             raise NotImplementedError("Port Type: %s not supported" %(c_point.type_yang))
 
         # By default port gets created with post_security enaled as True
-        if 'port_security_enabled' in c_point:
-            kwargs['port_security_enabled'] = c_point.port_security_enabled
+        if c_point.port_security_enabled is not None and c_point.port_security_enabled == False:
+            kwargs['port_security_enabled'] = False
+        else:
+            kwargs['port_security_enabled'] = True
 
         with self._use_driver(account) as drv:
             if c_point.has_field('security_group'):
index 2568d54..081875c 100755 (executable)
@@ -1123,9 +1123,7 @@ class VirtualNetworkFunctionRecord(object):
             cpr = VnfrYang.YangData_Vnfr_VnfrCatalog_Vnfr_ConnectionPoint()
             cpr.name = conn_p.name
             cpr.type_yang = conn_p.type_yang
-            if conn_p.has_field('port_security_enabled'):
-              cpr.port_security_enabled = conn_p.port_security_enabled
-
+            cpr.port_security_enabled = conn_p.port_security_enabled
             vlr_ref = find_vlr_for_cp(conn_p)
             if vlr_ref is None:
                 msg = "Failed to find VLR for cp = %s" % conn_p.name
index 34eda9d..b86d84f 100755 (executable)
@@ -645,12 +645,10 @@ ssh_authorized_keys:
 
         cp_list = []
         for intf, cp, vlr in self._ext_intf:
-            cp_info = { "name": cp.name,
-                        "virtual_link_id": vlr.network_id,
-                        "type_yang": intf.virtual_interface.type_yang }
-
-            if cp.has_field('port_security_enabled'):
-                cp_info["port_security_enabled"] = cp.port_security_enabled
+            cp_info = {"name": cp.name,
+                       "virtual_link_id": vlr.network_id,
+                       "type_yang": intf.virtual_interface.type_yang,
+                       "port_security_enabled": cp.port_security_enabled}
 
             if (intf.virtual_interface.has_field('vpci') and
                     intf.virtual_interface.vpci is not None):
@@ -669,16 +667,10 @@ ssh_authorized_keys:
                                 "type_yang": intf.virtual_interface.type_yang,
                                 "vpci": intf.virtual_interface.vpci})
             else:
-                if cp.has_field('port_security_enabled'):
-                    cp_list.append({"name": cp,
-                                    "virtual_link_id": vlr.network_id,
-                                    "type_yang": intf.virtual_interface.type_yang,
-                                    "port_security_enabled": cp.port_security_enabled})
-                else:
-                    cp_list.append({"name": cp,
-                                    "virtual_link_id": vlr.network_id,
-                                    "type_yang": intf.virtual_interface.type_yang})
-
+                cp_list.append({"name": cp,
+                                "virtual_link_id": vlr.network_id,
+                                "type_yang": intf.virtual_interface.type_yang,
+                                "port_security_enabled": cp.port_security_enabled})
 
         vm_create_msg_dict["connection_points"] = cp_list
         vm_create_msg_dict.update(vdu_copy_dict)