430 |
430 |
431 propstr = None |
431 propstr = None |
432 if proplist: |
432 if proplist: |
433 propstr = ",".join(proplist) |
433 propstr = ",".join(proplist) |
434 |
434 |
435 # TODO(gmoodalb): extract the tenant id if an admin is creating for |
|
436 # someone else |
|
437 evsname = subnet['subnet']['network_id'] |
435 evsname = subnet['subnet']['network_id'] |
438 tenantname = subnet['subnet']['tenant_id'] |
436 tenantname = self._get_tenant_id_for_create(context, subnet['subnet']) |
439 ipnet = self.evs_controller_addIPnet(tenantname, evsname, ipnetname, |
437 ipnet = self.evs_controller_addIPnet(tenantname, evsname, ipnetname, |
440 propstr) |
438 propstr) |
441 retval = self._convert_ipnet_to_subnet(ipnet) |
439 retval = self._convert_ipnet_to_subnet(ipnet) |
442 |
440 |
443 # notify dhcp agent of subnet creation |
441 # notify dhcp agent of subnet creation |
624 """ |
622 """ |
625 evsname = network['network']['name'] |
623 evsname = network['network']['name'] |
626 if not evsname: |
624 if not evsname: |
627 evsname = None |
625 evsname = None |
628 |
626 |
629 tenantname = network['network']['tenant_id'] |
627 tenantname = self._get_tenant_id_for_create(context, |
|
628 network['network']) |
630 proplist = [] |
629 proplist = [] |
631 network_type = network['network'][providernet.NETWORK_TYPE] |
630 network_type = network['network'][providernet.NETWORK_TYPE] |
632 if attributes.is_attr_set(network_type): |
631 if attributes.is_attr_set(network_type): |
633 proplist.append('l2-type=%s' % network_type) |
632 proplist.append('l2-type=%s' % network_type) |
634 |
633 |
815 propstr = None |
814 propstr = None |
816 if proplist: |
815 if proplist: |
817 propstr = ",".join(proplist) |
816 propstr = ",".join(proplist) |
818 |
817 |
819 evsname = port['port']['network_id'] |
818 evsname = port['port']['network_id'] |
820 tenantname = port['port']['tenant_id'] |
819 tenantname = self._get_tenant_id_for_create(context, port['port']) |
821 # TODO(gmoodalb): -- pull it from the network_id!! |
|
822 if not tenantname: |
820 if not tenantname: |
823 tenantname = context.tenant_id |
821 network = self.get_network(context, evsname) |
|
822 tenantname = network['tenant_id'] |
824 vport = self.evs_controller_addVPort(tenantname, evsname, vportname, |
823 vport = self.evs_controller_addVPort(tenantname, evsname, vportname, |
825 propstr) |
824 propstr) |
826 retval = self._convert_vport_to_port(context, vport) |
825 retval = self._convert_vport_to_port(context, vport) |
827 |
826 |
828 # notify dhcp agent of port creation |
827 # notify dhcp agent of port creation |
950 def _release_l3agent_internal_port(self, context, port): |
949 def _release_l3agent_internal_port(self, context, port): |
951 """ If an L3 agent is using this port, then we need to send |
950 """ If an L3 agent is using this port, then we need to send |
952 a notification to L3 agent to release the port before we can |
951 a notification to L3 agent to release the port before we can |
953 delete the port""" |
952 delete the port""" |
954 |
953 |
955 if port['device_owner'] not in [l3_constants.DEVICE_OWNER_ROUTER_INTF, |
954 device_owner = port['device_owner'] |
956 l3_constants.DEVICE_OWNER_ROUTER_GW, |
955 if device_owner not in [l3_constants.DEVICE_OWNER_ROUTER_INTF, |
957 l3_constants.DEVICE_OWNER_FLOATINGIP]: |
956 l3_constants.DEVICE_OWNER_ROUTER_GW, |
|
957 l3_constants.DEVICE_OWNER_FLOATINGIP]: |
958 return |
958 return |
959 router_id = port['device_id'] |
959 router_id = port['device_id'] |
960 port_update = { |
960 port_update = { |
961 'port': { |
961 'port': { |
962 'device_id': '', |
962 'device_id': '', |
963 'device_owner': '' |
963 'device_owner': '' |
964 } |
964 } |
965 } |
965 } |
966 self.update_port(context, port['id'], port_update) |
966 self.update_port(context, port['id'], port_update) |
967 msg = l3_rpc_agent_api.L3AgentNotify.make_msg("routers_updated", |
967 if device_owner in [l3_constants.DEVICE_OWNER_ROUTER_INTF, |
968 routers=[router_id]) |
968 l3_constants.DEVICE_OWNER_ROUTER_GW]: |
969 l3_rpc_agent_api.L3AgentNotify.call(context, msg, |
969 msg = l3_rpc_agent_api.L3AgentNotify.make_msg("routers_updated", |
970 topic=topics.L3_AGENT) |
970 routers=[router_id]) |
|
971 l3_rpc_agent_api.L3AgentNotify.call(context, msg, |
|
972 topic=topics.L3_AGENT) |
971 |
973 |
972 @lockutils.synchronized('evs-plugin', 'neutron-') |
974 @lockutils.synchronized('evs-plugin', 'neutron-') |
973 def evs_controller_removeVPort(self, tenantname, evsname, vportuuid): |
975 def evs_controller_removeVPort(self, tenantname, evsname, vportuuid): |
974 try: |
976 try: |
975 pat = radcli.ADRGlobPattern({'name': evsname, |
977 pat = radcli.ADRGlobPattern({'name': evsname, |