def _process_new_physical_ports(self, context, new_physical_ports): for physical_port in new_physical_ports: pp_dict = physical_port pp_dict[n_const.OVSDB_IDENTIFIER] = self.ovsdb_identifier p_port = db.get_physical_port(context, pp_dict) if not p_port: db.add_physical_port(context, pp_dict) if pp_dict.get('vlan_bindings'): for vlan_binding in pp_dict.get('vlan_bindings'): vlan_binding[ n_const.OVSDB_IDENTIFIER] = self.ovsdb_identifier vlan_binding['port_uuid'] = pp_dict.get('uuid') v_binding = db.get_vlan_binding(context, vlan_binding) if not v_binding: db.add_vlan_binding(context, vlan_binding)
def test_get_vlan_binding(self): record_dict = self._get_vlan_binding_dict() with self.ctx.session.begin(subtransactions=True): entry = self._create_vlan_binding(record_dict) result = lib.get_vlan_binding(self.ctx, record_dict) self.assertEqual(entry, result)