# flag to indicate if we use bidirectional forwarding rules in the
# automatic chaining process
-BIDIRECTIONAL_CHAIN = False
+BIDIRECTIONAL_CHAIN = True
# override the management interfaces in the descriptors with default
# docker0 interfaces in the containers
volumes=volumes,
type=kwargs.get('type', 'docker'))
+ # add vnfd reference to vnfi
+ vnfi.vnfd = vnfd
+
# rename the docker0 interfaces (eth0) to the management port name
# defined in the VNFD
if USE_DOCKER_MGMT:
# eg. different services get a unique cookie for their flowrules
cookie = 1
for link in eline_fwd_links:
+ LOG.info("Found E-Line: {}".format(link))
# check if we need to deploy this link when its a management link:
if USE_DOCKER_MGMT:
if self.check_mgmt_interface(
# Link between 2 VNFs
else:
+ LOG.info("Creating E-Line: src={}, dst={}"
+ .format(src_id, dst_id))
# make sure we use the correct sap vnf name
if src_sap_id in self.saps_int:
src_id = src_sap_id
if dst_sap_id in self.saps_int:
dst_id = dst_sap_id
- # re-configure the VNFs IP assignment and ensure that a new
- # subnet is used for each E-Link
+ # get involved vnfis
src_vnfi = self._get_vnf_instance(instance_uuid, src_id)
dst_vnfi = self._get_vnf_instance(instance_uuid, dst_id)
+
if src_vnfi is not None and dst_vnfi is not None:
+ setChaining = True
+ # re-configure the VNFs IP assignment and ensure that a new
+ # subnet is used for each E-Link
eline_net = ELINE_SUBNETS.pop(0)
ip1 = "{0}/{1}".format(str(eline_net[1]),
eline_net.prefixlen)
ip2 = "{0}/{1}".format(str(eline_net[2]),
eline_net.prefixlen)
- self._vnf_reconfigure_network(src_vnfi, src_if_name, ip1)
- self._vnf_reconfigure_network(dst_vnfi, dst_if_name, ip2)
- setChaining = True
+ # check if VNFs have fixed IPs (address field in VNFDs)
+ if (self._get_vnfd_cp_from_vnfi(src_vnfi, src_if_name)
+ .get("address") is None):
+ self._vnf_reconfigure_network(src_vnfi, src_if_name, ip1)
+ # check if VNFs have fixed IPs (address field in VNFDs)
+ if (self._get_vnfd_cp_from_vnfi(dst_vnfi, dst_if_name)
+ .get("address") is None):
+ self._vnf_reconfigure_network(dst_vnfi, dst_if_name, ip2)
# Set the chaining
if setChaining:
src_id, dst_id,
vnf_src_interface=src_if_name, vnf_dst_interface=dst_if_name,
bidirectional=BIDIRECTIONAL_CHAIN, cmd="add-flow", cookie=cookie, priority=10)
- LOG.debug(
- "Setting up E-Line link. (%s:%s) -> (%s:%s)" % (
- src_id, src_if_name, dst_id, dst_if_name))
+
+ def _get_vnfd_cp_from_vnfi(self, vnfi, ifname):
+ """
+ Gets the connection point data structure from the VNFD
+ of the given VNFI using ifname.
+ """
+ if vnfi.vnfd is None:
+ return {}
+ cps = vnfi.vnfd.get("connection_points")
+ for cp in cps:
+ if cp.get("id") == ifname:
+ return cp
def _connect_elans(self, elan_fwd_links, instance_uuid):
"""
return "No path could be found between {0} and {1}".format(
vnf_src_name, vnf_dst_name)
- LOG.info("Path between {0} and {1}: {2}".format(
+ LOG.debug("Creating path between {0} and {1}: {2}".format(
vnf_src_name, vnf_dst_name, path))
current_hop = src_sw
if next_hop == vnf_dst_name:
switch_outport_nr = dst_sw_outport_nr
- LOG.info("end node reached: {0}".format(vnf_dst_name))
+ LOG.debug("end node reached: {0}".format(vnf_dst_name))
elif not isinstance(next_node, OVSSwitch):
LOG.info("Next node: {0} is not a switch".format(next_hop))
return "Next node: {0} is not a switch".format(next_hop)
return "No path could be found between {0} and {1}".format(
vnf_src_name, vnf_dst_name)
- LOG.info("Path between {0} and {1}: {2}".format(
+ LOG.debug("Creating path between {0} and {1}: {2}".format(
vnf_src_name, vnf_dst_name, path))
current_hop = src_sw
if next_hop == vnf_dst_name:
switch_outport_nr = dst_sw_outport_nr
- LOG.info("end node reached: {0}".format(vnf_dst_name))
+ LOG.debug("end node reached: {0}".format(vnf_dst_name))
elif not isinstance(next_node, OVSSwitch):
LOG.info("Next node: {0} is not a switch".format(next_hop))
return "Next node: {0} is not a switch".format(next_hop)
'match_input': kwargs.get('match')
}
flow_options_str = json.dumps(flow_options, indent=1)
+ LOG.info("Installed flow rule: ({}:{}) -> ({}:{}) with options: {}"
+ .format(vnf_src_name, vnf_src_interface, vnf_dst_name, vnf_dst_interface, flow_options))
return "success: {2} between {0} and {1} with options: {3}".format(
vnf_src_name, vnf_dst_name, cmd, flow_options_str)