def setUpClass(self): self.maxDiff = None self.node_a = Node(name='nodeA', lat=0, lon=0) self.node_b = Node(name='nodeB', lat=0, lon=0) self.interface_a = Interface(name='inerfaceA-to-B', cost=4, capacity=100, node_object=self.node_a, remote_node_object=self.node_b, circuit_id=1) self.interface_b = Interface(name='inerfaceB-to-A', cost=4, capacity=100, node_object=self.node_b, remote_node_object=self.node_a, circuit_id=1) self.rsvp_lsp_a = RSVP_LSP(source_node_object=self.node_a, dest_node_object=self.node_b, lsp_name='A-to-B') self.model = PerformanceModel( interface_objects=set([self.interface_a, self.interface_b]), node_objects=set([self.node_a, self.node_b]), demand_objects=set([]), rsvp_lsp_objects=set([self.rsvp_lsp_a])) self.demand = Demand(source_node_object=self.node_a, dest_node_object=self.node_b, traffic=10, name='A-to-B')
def test_demand_on_lsp(self): """ Ensure the demand takes an available LSP :return: """ node_a = Node(name="nodeA", lat=0, lon=0) node_b = Node(name="nodeB", lat=0, lon=0) node_d = Node(name="nodeD") interface_a = Interface( name="inerfaceA-to-B", cost=4, capacity=100, node_object=node_a, remote_node_object=node_b, circuit_id=1, ) interface_b = Interface( name="inerfaceB-to-A", cost=4, capacity=100, node_object=node_b, remote_node_object=node_a, circuit_id=1, ) dmd_a_b = Demand(node_a, node_b, traffic=10) lsp_a_b = RSVP_LSP(source_node_object=node_a, dest_node_object=node_b, lsp_name="lsp_a_b") model = FlexModel( interface_objects=set([interface_a, interface_b]), node_objects=set([node_a, node_b, node_d]), demand_objects=set([dmd_a_b]), rsvp_lsp_objects=set([lsp_a_b]), ) model.update_simulation() self.assertEqual( str(dmd_a_b.path), "[[RSVP_LSP(source = nodeA, dest = nodeB, lsp_name = 'lsp_a_b')]]", )
def test_demand_on_lsp(self): """ Ensure the demand takes an available LSP :return: """ node_a = Node(name='nodeA', lat=0, lon=0) node_b = Node(name='nodeB', lat=0, lon=0) node_d = Node(name='nodeD') interface_a = Interface(name='inerfaceA-to-B', cost=4, capacity=100, node_object=node_a, remote_node_object=node_b, address=1) interface_b = Interface(name='inerfaceB-to-A', cost=4, capacity=100, node_object=node_b, remote_node_object=node_a, address=1) dmd_a_b = Demand(node_a, node_b, traffic=10) lsp_a_b = RSVP_LSP(source_node_object=node_a, dest_node_object=node_b, lsp_name='lsp_a_b') model = Model(interface_objects=set([interface_a, interface_b]), node_objects=set([node_a, node_b, node_d]), demand_objects=set([dmd_a_b]), rsvp_lsp_objects=set([lsp_a_b])) model.update_simulation() self.assertEqual( str(dmd_a_b.path), "[RSVP_LSP(source = nodeA, dest = nodeB, lsp_name = 'lsp_a_b')]")
from pprint import pprint from pyNTM import PerformanceModel from pyNTM import RSVP_LSP model = PerformanceModel.load_model_file('perf_model_lsp_metric.csv') model.update_simulation() lsp_a_d_1 = model.get_rsvp_lsp('A', 'D', 'lsp_a_d_1') lsp_a_d_2 = model.get_rsvp_lsp('A', 'D', 'lsp_a_d_2') print("lsp_a_d_2 config_setup_bw = {}".format( lsp_a_d_2.configured_setup_bandwidth)) print("lsp_a_d_2 setup_bw = {}".format(lsp_a_d_2.setup_bandwidth)) print("lsp_a_d_2 manual_metric = {}".format(lsp_a_d_2.manual_metric)) print('lsp_a_d_2 path = ') pprint(lsp_a_d_2.path) print() print("lsp_a_d_1 setup_bw = {}".format(lsp_a_d_1.configured_setup_bandwidth)) print("lsp_a_d_1 manual_metric = {}".format(lsp_a_d_1.manual_metric)) print("lsp_a_d_1 effective_metric = {}".format( lsp_a_d_1.effective_metric(model))) print("lsp_a_d_1 topology_metric = {}".format( lsp_a_d_1.topology_metric(model))) new_lsp = RSVP_LSP(model.get_node_object('A'), model.get_node_object('G'), 'lsp_a_f_manual_enter', configured_setup_bandwidth=float('4'), configured_manual_metric=float('10'))
from pyNTM import RSVP_LSP model = PerformanceModel.load_model_file("perf_model_lsp_metric.csv") model.update_simulation() lsp_a_d_1 = model.get_rsvp_lsp("A", "D", "lsp_a_d_1") lsp_a_d_2 = model.get_rsvp_lsp("A", "D", "lsp_a_d_2") print("lsp_a_d_2 config_setup_bw = {}".format( lsp_a_d_2.configured_setup_bandwidth)) print("lsp_a_d_2 setup_bw = {}".format(lsp_a_d_2.setup_bandwidth)) print("lsp_a_d_2 manual_metric = {}".format(lsp_a_d_2.manual_metric)) print("lsp_a_d_2 path = ") pprint(lsp_a_d_2.path) print() print("lsp_a_d_1 setup_bw = {}".format(lsp_a_d_1.configured_setup_bandwidth)) print("lsp_a_d_1 manual_metric = {}".format(lsp_a_d_1.manual_metric)) print("lsp_a_d_1 effective_metric = {}".format( lsp_a_d_1.effective_metric(model))) print("lsp_a_d_1 topology_metric = {}".format( lsp_a_d_1.topology_metric(model))) new_lsp = RSVP_LSP( model.get_node_object("A"), model.get_node_object("G"), "lsp_a_f_manual_enter", configured_setup_bandwidth=float("4"), configured_manual_metric=float("10"), )