# Attention: This is not a configuration switch but a global variable! Don't change its default value.
DEPLOY_SAP = False
+# flag to indicate if we use bidirectional forwarding rules in the automatic chaining process
+BIDIRECTIONAL_CHAIN = False
+
class Gatekeeper(object):
def __init__(self):
self.eline_subnets_src = generate_subnet_strings(50, start=200, subnet_size=24, ip=1)
self.eline_subnets_dst = generate_subnet_strings(50, start=200, subnet_size=24, ip=2)
-
def onboard(self):
"""
Do all steps to prepare this service to be instantiated
ret = network.setChain(
src_docker_name, dst_docker_name,
vnf_src_interface=src_if_name, vnf_dst_interface=dst_if_name,
- bidirectional=True, cmd="add-flow", cookie=cookie, priority=10)
+ bidirectional=BIDIRECTIONAL_CHAIN, cmd="add-flow", cookie=cookie, priority=10)
# re-configure the VNFs IP assignment and ensure that a new subnet is used for each E-Link
src_vnfi = self._get_vnf_instance(instance_uuid, src_name)
# 4b. deploy E-LAN links
base = 10
for link in elan_fwd_links:
+
+ elan=[]
+
# generate lan ip address
ip = 1
for intf in link["connection_points_reference"]:
if vnf_id in self.sap_identifiers:
src_docker_name = "{0}_{1}".format(vnf_id, intf_name)
vnf_id = src_docker_name
+ else:
+ src_docker_name = vnf_id
vnf_name = vnf_id2vnf_name[vnf_id]
LOG.debug(
"Setting up E-LAN link. %s(%s:%s) -> %s" % (
self._vnf_reconfigure_network(vnfi, intf_name, ip_address)
# increase for the next ip address on this E-LAN
ip += 1
+
+ # add this vnf and interface to the E-LAN for tagging
+ network = self.vnfds[vnf_name].get("dc").net # there should be a cleaner way to find the DCNetwork
+ elan.append({'name':src_docker_name,'interface':intf_name})
+
+
+ # install the VLAN tags for this E-LAN
+ print(elan)
+ network.setLAN(elan)
# increase the base ip address for the next E-LAN
base += 1
# set of the connection_point ids found in the nsd (in the examples this is 'ns')
self.sap_identifiers.add(sap_vnf_id)
- sap_docker_name = sap.replace(':', '_')
+ sap_docker_name = "%s_%s" % (sap_vnf_id, sap_vnf_interface)
# add SAP to self.vnfds
sapfile = pkg_resources.resource_filename(__name__, "sap_vnfd.yml")
s = Service(service_uuid, file_hash, upload_path)
GK.register_service_package(service_uuid, s)
# generate the JSON result
- return {"service_uuid": service_uuid, "size": size, "sha1": file_hash, "error": None}
+ return {"service_uuid": service_uuid, "size": size, "sha1": file_hash, "error": None}, 201
except Exception as ex:
LOG.exception("Service package upload failed:")
return {"service_uuid": None, "size": 0, "sha1": None, "error": "upload failed"}, 500