def create_port(self, context, port): port_id = uuidutils.generate_uuid() tags = utils.build_v3_tags_payload(port['port']) port['port']['id'] = port_id # TODO(salv-orlando): Undo logical switch creation on failure with context.session.begin(subtransactions=True): neutron_db = super(NsxV3Plugin, self).create_port(context, port) port["port"].update(neutron_db) address_bindings = self._build_address_bindings(port['port']) # FIXME(arosen): we might need to pull this out of the transaction # here later. result = nsxlib.create_logical_port( lswitch_id=port['port']['network_id'], vif_uuid=port_id, name=port['port']['name'], tags=tags, admin_state=port['port']['admin_state_up'], address_bindings=address_bindings) # TODO(salv-orlando): The logical switch identifier in the mapping # object is not necessary anymore. nsx_db.add_neutron_nsx_port_mapping( context.session, neutron_db['id'], neutron_db['network_id'], result['id']) self._process_portbindings_create_and_update(context, port['port'], neutron_db) neutron_db[pbin.VNIC_TYPE] = pbin.VNIC_NORMAL return neutron_db
def create_network(self, context, network): tags = utils.build_v3_tags_payload(network['network']) result = nsxlib.create_logical_switch( network['network']['name'], cfg.CONF.default_tz_uuid, tags) network['network']['id'] = result['id'] network = super(NsxV3Plugin, self).create_network(context, network) # TODO(salv-orlando): Undo logical switch creation on failure return network
def create_network(self, context, network): tags = utils.build_v3_tags_payload(network["network"]) result = nsxlib.create_logical_switch(network["network"]["name"], cfg.CONF.default_tz_uuid, tags) network["network"]["id"] = result["id"] tenant_id = self._get_tenant_id_for_create(context, network["network"]) self._ensure_default_security_group(context, tenant_id) network = super(NsxV3Plugin, self).create_network(context, network) # TODO(salv-orlando): Undo logical switch creation on failure return network
def create_router(self, context, router): tags = utils.build_v3_tags_payload(router["router"]) result = nsxlib.create_logical_router( display_name=router["router"].get("name", "a_router_with_no_name"), tier_0=True, edge_cluster_uuid=cfg.CONF.nsx_v3.default_edge_cluster_uuid, tags=tags, ) with context.session.begin(): router = super(NsxV3Plugin, self).create_router(context, router) nsx_db.add_neutron_nsx_router_mapping(context.session, router["id"], result["id"]) return router