"""
def __init__(self, listenip, port, deploy_sap=False, docker_management=False,
- auto_deploy=False, auto_delete=False, sap_vnfd_path=None):
+ auto_deploy=False, auto_delete=False, sap_vnfd_path=None, bidirectional=False, placement=None):
self.dcs = {}
self.ip = listenip
self.port = port
dgk.AUTO_DEPLOY = auto_deploy
dgk.AUTO_DELETE = auto_delete
dgk.SAP_VNFD = sap_vnfd_path
+ dgk.BIDIRECTIONAL_CHAIN = bidirectional
+ if placement is not None:
+ dgk.PLACEMENT_ALGORITHM = placement
logging.debug("Created API endpoint %s" % self)
def __repr__(self):
# and also automatically terminate any other running services
AUTO_DELETE = False
+# default placement algorithm to use for this dummygatekeeper instance
+# we need to use the name of the class as a string
+PLACEMENT_ALGORITHM = 'RoundRobinDcPlacementWithSAPs'
+
def generate_subnets(prefix, base, subnet_size=50, mask=24):
# Generate a list of ipaddress in subnets
r = list()
# 2. compute placement of this service instance (adds DC names to VNFDs)
if not GK_STANDALONE_MODE:
#self._calculate_placement(FirstDcPlacement)
- self._calculate_placement(RoundRobinDcPlacementWithSAPs)
+ #self._calculate_placement(RoundRobinDcPlacementWithSAPs)
+ self._calculate_placement(eval(PLACEMENT_ALGORITHM))
# 3. start all vnfds that we have in the service (except SAPs)
for vnf_id in self.vnfds:
vnfd = self.vnfds[vnf_id]
def _start_sap(self, sap, instance_uuid):
if not DEPLOY_SAP:
+ LOG.debug("Not deploying SAPs")
return
LOG.info('start SAP: {0} ,type: {1}'.format(sap['name'],sap['type']))
dc = dcs_list[randint(0, dc_len-1)]
saps[intf_sap_id]['dc'] = dc
+class CustomPlacementvCDN(object):
+ """
+ Custom placement (hard-coded) for the vCDN example on a 3 pop topology.
+ """
+ def place(self, nsd, vnfds, saps, dcs):
+ vnfds['squid1']["dc"] = dcs['dc1']
+ vnfds['webserver']["dc"] = dcs['dc3']
+ saps['vCDN-SAP1']["dc"] = dcs['dc1']
+ saps['vCDN-SAP2']["dc"] = dcs['dc2']
+
"""
Resource definitions and API endpoints
"""
-
class Packages(fr.Resource):
def post(self):