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
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
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