14 # License for the specific language governing permissions and limitations |
14 # License for the specific language governing permissions and limitations |
15 # under the License. |
15 # under the License. |
16 # |
16 # |
17 # @author: Girish Moodalbail, Oracle, Inc. |
17 # @author: Girish Moodalbail, Oracle, Inc. |
18 |
18 |
|
19 import netaddr |
19 import rad.client as radcli |
20 import rad.client as radcli |
20 import rad.connect as radcon |
21 import rad.connect as radcon |
21 import rad.bindings.com.oracle.solaris.rad.evscntl_1 as evsbind |
22 import rad.bindings.com.oracle.solaris.rad.evscntl_1 as evsbind |
22 |
23 |
23 from oslo.config import cfg |
24 from oslo.config import cfg |
267 hrlist = [] |
268 hrlist = [] |
268 vlist = prop.value.split(',') |
269 vlist = prop.value.split(',') |
269 for i in range(0, len(vlist), 2): |
270 for i in range(0, len(vlist), 2): |
270 hrlist.append({vlist[i]: vlist[i + 1]}) |
271 hrlist.append({vlist[i]: vlist[i + 1]}) |
271 subnetdict['host_routes'] = hrlist |
272 subnetdict['host_routes'] = hrlist |
272 subnetdict['allocation_pools'] = \ |
273 # EVS Controller returns a pool that includes gateway_ip as-well, |
273 [{'start': ipnet.start, 'end': ipnet.end}] |
274 # however neutron expects pool without gateway_ip. So, we determine |
|
275 # the pool ourselves here. |
|
276 assert 'gateway_ip' in subnetdict |
|
277 start_ip = netaddr.IPAddress(ipnet.start) |
|
278 end_ip = netaddr.IPAddress(ipnet.end) |
|
279 gw_ip = netaddr.IPAddress(subnetdict['gateway_ip']) |
|
280 pools = [] |
|
281 if gw_ip == start_ip: |
|
282 pools.append({'start' : str(netaddr.IPAddress(start_ip + 1)), |
|
283 'end': str(netaddr.IPAddress(end_ip))}) |
|
284 elif gw_ip == end_ip: |
|
285 pools.append({'start' : str(netaddr.IPAddress(start_ip)), |
|
286 'end': str(netaddr.IPAddress(end_ip - 1))}) |
|
287 else: |
|
288 pools.append({'start': str(netaddr.IPAddress(start_ip)), |
|
289 'end' : str(netaddr.IPAddress(gw_ip - 1))}) |
|
290 pools.append({'start': str(netaddr.IPAddress(gw_ip + 1)), |
|
291 'end' : str(netaddr.IPAddress(end_ip))}) |
|
292 |
|
293 subnetdict['allocation_pools'] = pools |
274 subnetdict['shared'] = False |
294 subnetdict['shared'] = False |
275 |
295 |
276 return subnetdict |
296 return subnetdict |
277 |
297 |
278 def _convert_vport_to_port(self, context, vport): |
298 def _convert_vport_to_port(self, context, vport): |
860 |
880 |
861 def delete_port(self, context, id, l3_port_check=True): |
881 def delete_port(self, context, id, l3_port_check=True): |
862 if l3_port_check: |
882 if l3_port_check: |
863 self.prevent_l3_port_deletion(context, id) |
883 self.prevent_l3_port_deletion(context, id) |
864 try: |
884 try: |
|
885 self.disassociate_floatingips(context, id) |
865 port = self.get_port(context, id) |
886 port = self.get_port(context, id) |
866 if not port: |
887 if not port: |
867 return |
888 return |
868 if not l3_port_check: |
889 if not l3_port_check: |
869 self._release_l3agent_internal_port(context, port) |
890 self._release_l3agent_internal_port(context, port) |