def update_port_precommit(self, context): #TODO: mac_learning port_data = context.current nsx_switch_id, nsx_port_id = nsx_utils.get_nsx_switch_and_port_id( context._plugin_context.session, self.cluster, port_data['id'] ) nsx_sec_profile_ids = self._convert_to_nsx_secgroup_ids( context, port_data.get('security_groups') or [] ) # ensure port_security_enabled flag set if nsx_switch_id: switchlib.update_port( self.cluster, nsx_switch_id, nsx_port_id, port_data['id'], port_data['tenant_id'], port_data['name'], port_data['device_id'], port_data['admin_state_up'], port_data['mac_address'], port_data['fixed_ips'], port_security_enabled=port_data['port_security_enabled'], security_profiles=nsx_sec_profile_ids, mac_learning_enabled=None, # TODO allowed_address_pairs=port_data['allowed_address_pairs'] )
def test_update_port(self): lswitch, lport = self._create_switch_and_port() switchlib.update_port(self.fake_cluster, lswitch['uuid'], lport['uuid'], 'neutron_port_id', 'pippo2', 'new_name', 'device_id', False) lport_res = switchlib.get_port(self.fake_cluster, lswitch['uuid'], lport['uuid']) self.assertEqual(lport['uuid'], lport_res['uuid']) self.assertEqual('new_name', lport_res['display_name']) self.assertEqual('False', lport_res['admin_status_enabled']) port_tags = self._build_tag_dict(lport_res['tags']) self.assertIn('os_tid', port_tags) self.assertIn('q_port_id', port_tags) self.assertIn('vm_id', port_tags)
def test_update_port(self): lswitch, lport = self._create_switch_and_port() switchlib.update_port( self.fake_cluster, lswitch['uuid'], lport['uuid'], 'neutron_port_id', 'pippo2', 'new_name', 'device_id', False) lport_res = switchlib.get_port(self.fake_cluster, lswitch['uuid'], lport['uuid']) self.assertEqual(lport['uuid'], lport_res['uuid']) self.assertEqual('new_name', lport_res['display_name']) self.assertEqual('False', lport_res['admin_status_enabled']) port_tags = self._build_tag_dict(lport_res['tags']) self.assertIn('os_tid', port_tags) self.assertIn('q_port_id', port_tags) self.assertIn('vm_id', port_tags)