topology.
"""
- def __init__(self, listenip, port, deploy_sap=False, docker_management=False, auto_deploy=False, auto_delete=False):
+ def __init__(self, listenip, port, deploy_sap=False, docker_management=False,
+ auto_deploy=False, auto_delete=False, sap_vnfd_path=None):
self.dcs = {}
self.ip = listenip
self.port = port
dgk.USE_DOCKER_MGMT = docker_management
dgk.AUTO_DEPLOY = auto_deploy
dgk.AUTO_DELETE = auto_delete
+ dgk.SAP_VNFD = sap_vnfd_path
logging.debug("Created API endpoint %s" % self)
def __repr__(self):
# 10.30.xxx.0/30
ELINE_SUBNETS = generate_subnets('10.30', 0, subnet_size=50, mask=30)
+# path to the VNFD for the SAP VNF that is deployed as internal SAP point
+SAP_VNFD=None
class Gatekeeper(object):
# Each Service Access Point (connection_point) in the nsd is getting its own container (default)
elif sap["type"] == "internal" or sap["type"] == "management":
# add SAP to self.vnfds
- sapfile = pkg_resources.resource_filename(__name__, "sap_vnfd.yml")
+ if SAP_VNFD is None:
+ sapfile = pkg_resources.resource_filename(__name__, "sap_vnfd.yml")
+ else:
+ sapfile = SAP_VNFD
sap_vnfd = load_yaml(sapfile)
sap_vnfd["connection_points"][0]["id"] = sap_interface
sap_vnfd["name"] = sap_docker_name
network_metric = {}\r
\r
# check if port is specified (vnf:port)\r
- if vnf_interface is None:\r
+ if vnf_interface is None or vnf_interface == '':\r
# take first interface by default\r
connected_sw = self.net.DCNetwork_graph.neighbors(vnf_name)[0]\r
link_dict = self.net.DCNetwork_graph[vnf_name][connected_sw]\r
previous_measurement = metric_dict['previous_measurement']\r
previous_monitor_time = metric_dict['previous_monitor_time']\r
mon_port = metric_dict['mon_port']\r
-\r
for port_stat in port_stat_dict[str(switch_dpid)]:\r
+ # ovs output also gives back 'LOCAL' port\r
+ if port_stat['port_no'] == 'LOCAL':\r
+ continue\r
if int(port_stat['port_no']) == int(mon_port):\r
port_uptime = port_stat['duration_sec'] + port_stat['duration_nsec'] * 10 ** (-9)\r
this_measurement = int(port_stat[metric_key])\r
from emuvim.api.rest.rest_api_endpoint import RestApiEndpoint
from emuvim.api.sonata import SonataDummyGatekeeperEndpoint
from mininet.node import RemoteController
+import os
logging.basicConfig(level=logging.INFO)
def create_topology1():
# create topology
- net = DCNetwork(controller=RemoteController, monitor=True, enable_learning=True)
+ net = DCNetwork(controller=RemoteController, monitor=False, enable_learning=True)
dc1 = net.addDatacenter("dc1")
# run API endpoint server (in another thread, don't block)
rapi1.start()
+
+ # specify a vnfd file to be deployed as internal SAP:
+ sap_vnfd = 'vepc_sap_vnfd.yml'
+ dir_path = os.path.dirname(__file__)
+ sap_vnfd_path = os.path.join(dir_path, sap_vnfd)
+ # sap_vnfd_path = None
# add the SONATA dummy gatekeeper to each DC
- sdkg1 = SonataDummyGatekeeperEndpoint("0.0.0.0", 5000, deploy_sap=True, auto_deploy=True, docker_management=True, auto_delete=True)
+ sdkg1 = SonataDummyGatekeeperEndpoint("0.0.0.0", 5000, deploy_sap=True, auto_deploy=True,
+ docker_management=True, auto_delete=True,
+ sap_vnfd_path=sap_vnfd_path)
sdkg1.connectDatacenter(dc1)
# run the dummy gatekeeper (in another thread, don't block)
sdkg1.start()
--- /dev/null
+
+---
+##
+## Some general information regarding this
+## VNF descriptor.
+##
+descriptor_version: "vnfd-schema-01"
+vendor: "eu.sonata-nfv"
+name: "sap_vnf"
+version: "0.1"
+author: "Steven Van Rossem, Ghent University, steven.vanrossem@intec.ugent.be"
+description: "A sink for the vEPC service"
+##
+## The virtual deployment unit.
+##
+virtual_deployment_units:
+ - id: "1"
+ vm_image: "sink:v3"
+ vm_image_format: "docker"
+ resource_requirements:
+ cpu:
+ vcpus: 1
+ memory:
+ size: 1
+ size_unit: "GB"
+ storage:
+ size: 1
+ size_unit: "GB"
+ connection_points:
+ - id: "vdu01:cp01"
+ type: "interface"
+
+##
+## The virtual links that interconnect
+## the different connections points.
+##
+virtual_links:
+ - id: "port"
+ connectivity_type: "E-Line"
+ connection_points_reference:
+ - "vdu01:cp01"
+ - "port"
+
+##
+## The VNF connection points to the
+## outside world.
+##
+connection_points:
+ - id: "port"
+ type: "interface"