Example #1
0
 def get_topo_desc ():
   # Create NFFG
   nffg = NFFG(id="DYNAMIC-FALLBACK-TOPO", name="fallback-dynamic")
   # Add NETCONF capable containers a.k.a. Execution Environments
   nc1 = nffg.add_infra(id="nc1", name="NC1", domain="INTERNAL",
                        infra_type=NFFG.TYPE_INFRA_EE, cpu=5, mem=5, storage=5,
                        delay=0.9, bandwidth=5000)
   nc2 = nffg.add_infra(id="nc2", name="NC2", domain="INTERNAL",
                        infra_type=NFFG.TYPE_INFRA_EE, cpu=5, mem=5, storage=5,
                        delay=0.9, bandwidth=5000)
   nc1.add_supported_type(['A', 'B'])
   nc2.add_supported_type(['A', 'C'])
   # Add inter-EE switches
   sw3 = nffg.add_infra(id="sw3", name="SW3", domain="INTERNAL",
                        infra_type=NFFG.TYPE_INFRA_SDN_SW, delay=0.2,
                        bandwidth=10000)
   sw4 = nffg.add_infra(id="sw4", name="SW4", domain="INTERNAL",
                        infra_type=NFFG.TYPE_INFRA_SDN_SW, delay=0.2,
                        bandwidth=10000)
   # Add SAPs
   sap1 = nffg.add_sap(id="sap1", name="SAP1")
   sap2 = nffg.add_sap(id="sap2", name="SAP2")
   # Add links
   linkres = {'delay': 1.5, 'bandwidth': 2000}
   nffg.add_link(nc1.add_port(1), sw3.add_port(1), id="l1", **linkres)
   nffg.add_link(nc2.add_port(1), sw4.add_port(1), id="l2", **linkres)
   nffg.add_link(sw3.add_port(2), sw4.add_port(2), id="l3", **linkres)
   nffg.add_link(sw3.add_port(3), sap1.add_port(1), id="l4", **linkres)
   nffg.add_link(sw4.add_port(3), sap2.add_port(1), id="l5", **linkres)
   # Duplicate one-way static links to become undirected in order to fit to
   # the orchestration algorithm
   # No need for that, ESCAPENetworkBridge do this later
   # nffg.duplicate_static_links()
   return nffg
Example #2
0
def getPicoTopo():
  """
  Not carrier style topo. Few nodes with big resources.
  """
  random.seed(0)
  nffg = NFFG(id="SmallExampleTopo")
  switch = {'cpu': 0, 'mem': 0, 'storage': 0, 'delay': 0.5,
            'bandwidth': 1000, 'infra_type': NFFG.TYPE_INFRA_SDN_SW}
  sw = nffg.add_infra(id = getName("sw"), **switch)
  infra = {'cpu': 400, 'mem': 320000, 'storage': 1500, 'delay': 1.0,
           'bandwidth': 10000, 'infra_type': NFFG.TYPE_INFRA_EE}
  linkres = {'bandwidth': 1000, 'delay': 0.5}

  inf1 = nffg.add_infra(id = getName("infra"), **infra)
  inf0 = inf1
  inf1.add_supported_type(list(string.ascii_uppercase)[:10])
  for i in range(0,4):
    if i == 3:
      inf2 = inf0
    else:
      inf2 = nffg.add_infra(id = getName("infra"), **infra)
      inf2.add_supported_type(list(string.ascii_uppercase)[:10])
    nameid = getName("sap")
    sap = nffg.add_sap(id = nameid, name = nameid)
    # add links


    nffg.add_undirected_link(sw.add_port(), inf2.add_port(), **linkres)
    nffg.add_undirected_link(inf1.add_port(), inf2.add_port(), **linkres)
    nffg.add_undirected_link(inf2.add_port(), sap.add_port(), **linkres)
    inf1 = inf2 
    
  return nffg
Example #3
0
 def get_topo_desc ():
   # Create NFFG
   nffg = NFFG(id="STATIC-FALLBACK-TOPO", name="fallback-static")
   # Add switches
   sw1 = nffg.add_infra(id="sw1", name="SW1", domain="INTERNAL",
                        infra_type=NFFG.TYPE_INFRA_SDN_SW)
   sw2 = nffg.add_infra(id="sw2", name="SW2", domain="INTERNAL",
                        infra_type=NFFG.TYPE_INFRA_SDN_SW)
   sw3 = nffg.add_infra(id="sw3", name="SW3", domain="INTERNAL",
                        infra_type=NFFG.TYPE_INFRA_SDN_SW)
   sw4 = nffg.add_infra(id="sw4", name="SW4", domain="INTERNAL",
                        infra_type=NFFG.TYPE_INFRA_SDN_SW)
   # Add SAPs
   sap1 = nffg.add_sap(id="sap1", name="SAP1")
   sap2 = nffg.add_sap(id="sap2", name="SAP2")
   # Add links
   nffg.add_link(sw1.add_port(1), sw3.add_port(1), id="l1")
   nffg.add_link(sw2.add_port(1), sw4.add_port(1), id="l2")
   nffg.add_link(sw3.add_port(2), sw4.add_port(2), id="l3")
   nffg.add_link(sw3.add_port(3), sap1.add_port(1), id="l4")
   nffg.add_link(sw4.add_port(3), sap2.add_port(1), id="l5")
   # Duplicate one-way static links to become undirected in order to fit to
   # the orchestration algorithm
   # nffg.duplicate_static_links()
   return nffg
Example #4
0
def getCarrierTopo(params, increment_port_ids=False):
  """
  Construct the core network and add PoPs with their parameters.
  params is a list of dictionaries with PoP data:
    'Retail': (BNAS, RCpb, RCT)
    'Business': (PE, BCpb, BCT)
    'CloudNFV': (CL,CH,SE,SAN_bw,SAN_sto,NF_types,SE_cores,SE_mem,SE_sto,
                 CL_bw, CH_links)
  WARNING: using this function with increment_port_ids=True this function is not 
  thread safe, because it uses global variable then!
  """
  # This initializes the random generator always to the same value, so the
  # returned index sequence, and thus the network parameters will be generated 
  # always the same (we want a fixed network environment)
  # The generated identifiers are still different between genereations, but 
  # those does not influence the mapping process
  random.seed(0)
  popcnt = 0
  nffg = NFFG(id="CarrierTopo")
  p = increment_port_ids
  backbone_res =  {'cpu': 0, 'mem': 0, 'storage': 0, 'delay': 0.5,
                   'bandwidth': 1000, 'infra_type': NFFG.TYPE_INFRA_SDN_SW}
  bn0 = nffg.add_infra(id=getName("bn"), **backbone_res)
  bn1 = nffg.add_infra(id=getName("bn"), **backbone_res)
  bn2 = nffg.add_infra(id=getName("bn"), **backbone_res)
  bn3 = nffg.add_infra(id=getName("bn"), **backbone_res)

  nffg.add_undirected_link(add_port(bn0, p), add_port(bn1, p), bandwidth=1000, 
                           delay=10)
  nffg.add_undirected_link(add_port(bn1, p), add_port(bn2, p), bandwidth=1000, 
                           delay=10)
  nffg.add_undirected_link(add_port(bn2, p), add_port(bn3, p), bandwidth=1000, 
                           delay=10)
  nffg.add_undirected_link(add_port(bn3, p), add_port(bn0, p), bandwidth=1000, 
                           delay=10)
  backbones = (bn0, bn1, bn2, bn3)
  bnlen = len(backbones)
  for popdata in params:
    tmp = []
    tmp.extend(popdata['Retail'])
    tmp.extend(popdata['Business'])
    tmp.extend(popdata['CloudNFV'])
    addPoP(nffg, popcnt, backbones[popcnt%bnlen], backbones[(popcnt+1)%bnlen],
           p, *tmp)
    popcnt += 1
  """
  #                      BNAS,RCpb,  RCT, PE,BCpb, BCT, CL,CH,SE, SAN_bw, 
  addPoP(nffg, bn2, bn3, 2,   10000, 0.2, 2, 4000, 0.2, 2, 8, 8,  160000,  
       # SAN_sto,NF_types,  SE_cores,  SE_mem,        SE_sto,  CL_bw, CH_links
         100000, ['A','B'], [8,12,16], [32000,64000], [150],   40000, 4)  
  #                      BNAS, RCpb,  RCT, PE,BCpb, BCT, CL,CH, SE, SAN_bw, 
  addPoP(nffg, bn1, bn2, 10,   40000, 0.2, 8, 4000, 0.2, 4, 40, 8,  160000,  
       # SAN_sto,NF_types,             SE_cores,  SE_mem,        SE_sto,    
         100000, ['A','B','C','D','E'],[8,12,16], [32000,64000], [150,200],  
       # CL_bw, CH_links
         80000, 8)
  """
  log.debug("Carrier topology construction finished!")
  return nffg
Example #5
0
def getSNDlib_dfn_gwin(save_to_file = False):
  """
  Topology taken from SNDlib, dfn-gwin.
  """
  random.seed(0)
  gwin = nx.read_gml("dfn-gwin.gml")
  nffg = NFFG(id="dfn-gwin")
  nf_types = list(string.ascii_uppercase)[:10]
  switch = {'cpu': 0, 'mem': 0, 'storage': 0, 'delay': 0.5,
            'bandwidth': 40000, 'infra_type': NFFG.TYPE_INFRA_SDN_SW}
  infrares = {'cpu': 400, 'mem': 320000, 'storage': 1500, 'delay': 1.0,
           'bandwidth': 40000, 'infra_type': NFFG.TYPE_INFRA_EE}
  corelinkres = {'bandwidth': 10000, 'delay': 1.0}
  aggrlinkres = {'bandwidth': 1000, 'delay': 5.0}
  acclinkres = {'bandwidth': 100, 'delay': 1.0}
  gwinnodes = []
  for n in  gwin.nodes_iter():
    gwinnodes.append(n.rstrip('.'))
  # get topology from dfn-gwin
  for n in gwinnodes:
    nffg.add_infra(id=n, **switch)
  for i,j in gwin.edges_iter():
    nffg.add_undirected_link(nffg.network.node[i.rstrip('.')].add_port(), 
                             nffg.network.node[j.rstrip('.')].add_port(), 
                             **corelinkres)

  
  nodeset1 = random.sample(gwinnodes, 3)
  nodeset1.extend(random.sample(gwinnodes, 3))
  # add cloud nodes to 6 random nodes.
  for n in nodeset1:
    infra = nffg.add_infra(id=getName(n+"Host"), **infrares)
    infra.add_supported_type(random.sample(nf_types, 6))
    nffg.add_undirected_link(nffg.network.node[n].add_port(), infra.add_port(), 
                             **corelinkres)
    
  nodeset2 = random.sample(gwinnodes, 3)
  nodeset2.extend(random.sample(gwinnodes, 3))
  # add access switched to 6 random nodes
  for n in nodeset2:
    sw = nffg.add_infra(id=getName(n+"Sw"), **switch)
    nffg.add_undirected_link(nffg.network.node[n].add_port(), sw.add_port(),
                             **aggrlinkres)
    for i in xrange(0,random.randint(3,4)):
      nameid = getName(n+"SAP")
      sap = nffg.add_sap(id=nameid, name=nameid)
      nffg.add_undirected_link(sap.add_port(), sw.add_port(), **acclinkres)
  
  # save it to file
  if save_to_file:
    augmented_gwin = nx.MultiDiGraph()
    augmented_gwin.add_nodes_from(nffg.network.nodes_iter())
    augmented_gwin.add_edges_from(nffg.network.edges_iter())
    nx.write_gml(augmented_gwin, "augmented-dfn-gwin.gml")

  return nffg
Example #6
0
def _testNetworkForBacktrack():
    nffg = NFFG(id="backtracktest", name="backtrack")
    sap1 = nffg.add_sap(name="SAP1", id="sap1")
    sap2 = nffg.add_sap(name="SAP2", id="sap2")

    uniformnoderes = {
        'cpu': 5,
        'mem': 5,
        'storage': 5,
        'delay': 0.4,
        'bandwidth': 5500
    }
    infra0 = nffg.add_infra(id="node0", name="INFRA0", **uniformnoderes)
    uniformnoderes2 = {
        'cpu': 9,
        'mem': 9,
        'storage': 9,
        'delay': 0.4,
        'bandwidth': 5500
    }
    infra1 = nffg.add_infra(id="node1", name="INFRA1", **uniformnoderes2)
    swres = {
        'cpu': 0,
        'mem': 0,
        'storage': 0,
        'delay': 0.0,
        'bandwidth': 10000
    }
    sw = nffg.add_infra(id="sw", name="sw1", **swres)

    infra0.add_supported_type(['A'])
    infra1.add_supported_type(['A'])

    unilinkres = {'delay': 0.0, 'bandwidth': 2000}
    nffg.add_undirected_link(sap1.add_port(0), infra0.add_port(0),
                             **unilinkres)
    nffg.add_undirected_link(sap2.add_port(0), infra1.add_port(0),
                             **unilinkres)
    rightlink = {'delay': 10.0, 'bandwidth': 2000}
    leftlink = {'delay': 0.01, 'bandwidth': 5000}
    nffg.add_link(infra0.add_port(1), sw.add_port(0), id="n0sw", **rightlink)
    nffg.add_link(sw.add_port(1), infra1.add_port(1), id="swn1", **rightlink)
    nffg.add_link(sw.ports[0], infra0.ports[1], id="swn0", **leftlink)
    nffg.add_link(infra1.ports[1], sw.ports[1], id="n1sw", **leftlink)

    return nffg
Example #7
0
def _constructExampleNetwork():
    nffg = NFFG(id="BME-net-001")
    uniformnoderes = {
        'cpu': 5,
        'mem': 5,
        'storage': 5,
        'delay': 0.9,
        'bandwidth': 5500
    }
    infra0 = nffg.add_infra(id="node0", name="INFRA0", **uniformnoderes)
    uniformnoderes['cpu'] = None
    infra1 = nffg.add_infra(id="node1", name="INFRA1", **uniformnoderes)
    uniformnoderes['mem'] = None
    infra2 = nffg.add_infra(id="node2", name="INFRA2", **uniformnoderes)
    uniformnoderes['storage'] = None
    switch = nffg.add_infra(id="sw0",
                            name="FastSwitcher",
                            delay=0.01,
                            bandwidth=10000)
    infra0.add_supported_type('A')
    infra1.add_supported_type(['B', 'C'])
    infra2.add_supported_type(['A', 'B', 'C'])
    sap0 = nffg.add_sap(name="SAP0", id="sap0innet")
    sap1 = nffg.add_sap(name="SAP1", id="sap1innet")

    unilinkres = {'delay': 1.5, 'bandwidth': 2000}
    # Infra links should be undirected, according to the currnet NFFG model
    # Infra link model is full duplex now.
    nffg.add_undirected_link(sap0.add_port(0), infra0.add_port(0),
                             **unilinkres)
    nffg.add_undirected_link(sap1.add_port(0), infra1.add_port(0),
                             **unilinkres)
    nffg.add_undirected_link(infra1.add_port(1), infra0.add_port(2),
                             **unilinkres)
    unilinkres['bandwidth'] = None
    nffg.add_undirected_link(infra0.add_port(1), infra2.add_port(0),
                             **unilinkres)
    nffg.add_undirected_link(infra1.add_port(2), infra2.add_port(1),
                             **unilinkres)
    unilinkres['delay'] = 0.2
    unilinkres['bandwidth'] = 5000
    nffg.add_undirected_link(switch.add_port(0), infra0.add_port(3),
                             **unilinkres)
    unilinkres['delay'] = None
    nffg.add_undirected_link(switch.add_port(1), infra1.add_port(3),
                             **unilinkres)
    nffg.add_undirected_link(switch.add_port(2), infra2.add_port(2),
                             **unilinkres)

    # test VNF mapping removal, and resource update in the substrate NFFG
    nf4 = nffg.add_nf(id="NF4inNet",
                      name="NetFunc4",
                      func_type='B',
                      cpu=1,
                      mem=1,
                      storage=1,
                      bandwidth=100,
                      delay=50)
    nffg.add_undirected_link(infra1.add_port(3), nf4.add_port(0), dynamic=True)
    nffg.add_undirected_link(infra1.add_port(4), nf4.add_port(1), dynamic=True)

    return nffg
Example #8
0
def _constructExampleRequest():
    nffg = NFFG(id="BME-req-001")
    sap0 = nffg.add_sap(name="SAP0", id="sap0")
    sap1 = nffg.add_sap(name="SAP1", id="sap1")

    # add NF requirements.
    # Note: storage is used now for the first time, it comes in with the
    # NodeResource class
    # Note: internal latency is only forwarded to lower layer
    # Note: internal bw is untested yet, even before the NFFG support
    nf0 = nffg.add_nf(id="NF0",
                      name="NetFunc0",
                      func_type='A',
                      cpu=2,
                      mem=2,
                      storage=2,
                      bandwidth=100)
    nf1 = nffg.add_nf(id="NF1",
                      name="NetFunc1",
                      func_type='B',
                      cpu=1.5,
                      mem=1.5,
                      storage=1.5,
                      delay=50)
    nf2 = nffg.add_nf(id="NF2",
                      name="NetFunc2",
                      func_type='C',
                      cpu=3,
                      mem=3,
                      storage=3,
                      bandwidth=500)
    nf3 = nffg.add_nf(id="NF3",
                      name="NetFunc3",
                      func_type='A',
                      cpu=2,
                      mem=2,
                      storage=2,
                      bandwidth=100,
                      delay=50)
    nf4 = nffg.add_nf(id="NF4",
                      name="NetFunc4",
                      func_type='C',
                      cpu=0,
                      mem=0,
                      storage=0,
                      bandwidth=500)

    # directed SG links
    # flowclass default: None, meaning: match all traffic
    # some agreement on flowclass format is required.
    nffg.add_sglink(sap0.add_port(0), nf0.add_port(0))
    nffg.add_sglink(nf0.add_port(1), nf1.add_port(0), flowclass="HTTP")
    nffg.add_sglink(nf1.add_port(1), nf2.add_port(0), flowclass="HTTP")
    nffg.add_sglink(nf2.add_port(1), sap1.add_port(1))
    nffg.add_sglink(nf0.add_port(2), nf3.add_port(0), flowclass="non-HTTP")
    nffg.add_sglink(nf3.add_port(1), nf2.add_port(2), flowclass="non-HTTP")
    nffg.add_sglink(nf1.add_port(2), nf4.add_port(0), flowclass="index.com")
    nffg.add_sglink(nf4.add_port(1), nf2.add_port(3), flowclass="index.com")

    # add EdgeReqs
    nffg.add_req(sap0.ports[0], sap1.ports[1], delay=40, bandwidth=1500)
    nffg.add_req(nf1.ports[1], nf2.ports[0], delay=3.5)
    nffg.add_req(nf3.ports[1], nf2.ports[2], bandwidth=500)
    nffg.add_req(sap0.ports[0], nf0.ports[0], delay=3.0)
    # force collocation of NF0 and NF3
    # nffg.add_req(nf0.ports[2], nf3.ports[0], delay=1.0)
    # not SAP-to-SAP requests are not taken into account yet, these are ignored
    nffg.add_req(nf0.ports[1], nf2.ports[0], delay=1.0)

    # test Infra node removal from the request NFFG
    infra1 = nffg.add_infra(id="BiS-BiS1")
    infra2 = nffg.add_infra(id="BiS-BiS2")
    nffg.add_undirected_link(infra1.add_port(0), nf0.add_port(3), dynamic=True)
    nffg.add_undirected_link(infra1.add_port(1), nf0.add_port(4), dynamic=True)
    nffg.add_undirected_link(infra1.add_port(2), nf1.add_port(3), dynamic=True)
    nffg.add_undirected_link(infra2.add_port(0), nf2.add_port(4), dynamic=True)
    nffg.add_undirected_link(infra2.add_port(1), nf3.add_port(2), dynamic=True)
    nffg.add_undirected_link(infra1.add_port(3),
                             infra2.add_port(2),
                             bandwidth=31241242)

    return nffg