X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=RO-VIM-openstack%2Fosm_rovim_openstack%2Fvimconn_openstack.py;h=bd3955ace7054bdd7017c0bcee32a13d86fac364;hb=3f8f2f4707c2a5095fd5cb9cc6602e7e9f33dbd8;hp=99cb64f1edb229c8d3c3ede2e6731563a1255e4c;hpb=cb66c7eab3945f92e9815cbb4007ed61679333d9;p=osm%2FRO.git diff --git a/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py b/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py index 99cb64f1..bd3955ac 100644 --- a/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py +++ b/RO-VIM-openstack/osm_rovim_openstack/vimconn_openstack.py @@ -152,7 +152,7 @@ class vimconnector(vimconn.VimConnector): logging.getLogger('urllib3').setLevel(logging.WARNING) logging.getLogger('keystoneauth').setLevel(logging.WARNING) logging.getLogger('novaclient').setLevel(logging.WARNING) - self.logger = logging.getLogger('openmano.vim.openstack') + self.logger = logging.getLogger('ro.vim.openstack') # allow security_groups to be a list or a single string if isinstance(self.config.get('security_groups'), str): @@ -161,7 +161,7 @@ class vimconnector(vimconn.VimConnector): # ###### VIO Specific Changes ######### if self.vim_type == "VIO": - self.logger = logging.getLogger('openmano.vim.vio') + self.logger = logging.getLogger('ro.vim.vio') if log_level: self.logger.setLevel(getattr(logging, log_level)) @@ -1225,6 +1225,7 @@ class vimconnector(vimconn.VimConnector): type: 'virtual', 'PCI-PASSTHROUGH'('PF'), 'SR-IOV'('VF'), 'VFnotShared' vim_id: filled/added by this function floating_ip: True/False (or it can be None) + port_security: True/False 'cloud_config': (optional) dictionary with: 'key-pairs': (optional) list of strings with the public key to be inserted to the default user 'users': (optional) list of users to be inserted, each item is a dict with: @@ -1338,7 +1339,7 @@ class vimconnector(vimconn.VimConnector): # is dropped. # As a workaround we wait until the VM is active and then disable the port-security if net.get("port_security") is False and not self.config.get("no_port_security_extension"): - no_secured_ports.append(new_port["port"]["id"]) + no_secured_ports.append((new_port["port"]["id"], net.get("port_security_disable_strategy"))) # if metadata_vpci: # metadata = {"pci_assignement": json.dumps(metadata_vpci)} @@ -1412,13 +1413,33 @@ class vimconnector(vimconn.VimConnector): if no_secured_ports: self.__wait_for_vm(server.id, 'ACTIVE') - for port_id in no_secured_ports: + for port in no_secured_ports: + port_update = { + "port": { + "port_security_enabled": False, + "security_groups": None + } + } + + if port[1] == "allow-address-pairs": + port_update = { + "port": { + "allowed_address_pairs": [ + { + "ip_address": "0.0.0.0/0" + } + ] + } + } + try: - self.neutron.update_port(port_id, - {"port": {"port_security_enabled": False, "security_groups": None}}) + self.neutron.update_port(port[0], port_update) except Exception: - raise vimconn.VimConnException("It was not possible to disable port security for port {}".format( - port_id)) + raise vimconn.VimConnException( + "It was not possible to disable port security for port {}" + .format(port[0]) + ) + # print "DONE :-)", server # pool_id = None @@ -1686,7 +1707,8 @@ class vimconnector(vimconn.VimConnector): else: vm['status'] = "OTHER" vm['error_msg'] = "VIM status reported " + vm_vim['status'] - + vm_vim.pop("OS-EXT-SRV-ATTR:user_data", None) + vm_vim.pop("user_data", None) vm['vim_info'] = self.serialize(vm_vim) vm["interfaces"] = []