def sync_domainsubnets(self, resources): for domsubn_id in resources['domainsubnet']['add']: # This is a dict of subn_id and the router interface port subn_rtr_intf_port_dict = ( resources['port']['sub_rtr_intf_port_dict']) port_id = subn_rtr_intf_port_dict[domsubn_id] port = self._get_port_data(port_id) if port: with self.context.session.begin(subtransactions=True): subnet, subl2dom = self._get_subnet_data(domsubn_id) if subnet: result = self.nuageclient.create_domainsubnet( subnet, port) if result: nuagedb.get_update_subnetl2dom_mapping( self.context.session, result)
def sync_l2domains(self, net_partition_id_dict, resources): for l2dom_id in resources['l2domain']['add']: with self.context.session.begin(subtransactions=True): subnet, subl2dom = self._get_subnet_data(l2dom_id) if subnet: # if subnet exists, subl2dom will exist netpart_id = subl2dom['net_partition_id'] if netpart_id in net_partition_id_dict.keys(): # Use the id of the newly created net_partition netpart_id = net_partition_id_dict[netpart_id] result = self.nuageclient.create_l2domain( netpart_id, subnet) if result: nuagedb.get_update_subnetl2dom_mapping( self.context.session, result)
def sync_domainsubnets(self, resources): for domsubn_id in resources['domainsubnet']['add']: # This is a dict of subn_id and the router interface port subn_rtr_intf_port_dict = ( resources['port']['sub_rtr_intf_port_dict']) port_id = subn_rtr_intf_port_dict[domsubn_id] port = self._get_port_data(port_id) if port: with self.context.session.begin(subtransactions=True): subnet, subl2dom = self._get_subnet_data(domsubn_id) if subnet: result = self.nuageclient.create_domainsubnet(subnet, port) if result: nuagedb.get_update_subnetl2dom_mapping( self.context.session, result)
def sync_l2domains(self, net_partition_id_dict, resources): for l2dom_id in resources['l2domain']['add']: with self.context.session.begin(subtransactions=True): subnet, subl2dom = self._get_subnet_data(l2dom_id) if subnet: # if subnet exists, subl2dom will exist netpart_id = subl2dom['net_partition_id'] if netpart_id in net_partition_id_dict.keys(): # Use the id of the newly created net_partition netpart_id = net_partition_id_dict[netpart_id] result = self.nuageclient.create_l2domain(netpart_id, subnet) if result: nuagedb.get_update_subnetl2dom_mapping( self.context.session, result)