def do_nat(self, arg): """Apply NAT configuration on all non-duplicated interfaces Specify no arguments will apply NAT with following config: 1. clients_net_start - 16.0.0.0 2. client_acl_wildcard_mask - 0.0.0.255 3. dual_port_mask - 1.0.0.0 4. pool_start - 200.0.0.0 5. pool_netmask - 255.255.255.0 """ if arg: nat_dict = load_object_config_file(arg) # else: # print termstyle.magenta("Unknown nat configutaion option requested. use 'help nat' for further info.") else: # print termstyle.magenta("Specific nat configutaion is missing. use 'help nat' for further info.") nat_dict = { 'clients_net_start': '16.0.0.0', 'client_acl_wildcard_mask': '0.0.0.255', 'dual_port_mask': '1.0.0.0', 'pool_start': '200.0.0.0', 'pool_netmask': '255.255.255.0' } nat_obj = CNatConfig(nat_dict) self.platform.config_nat(nat_obj) print(termstyle.green("NAT configuration applied successfully."))
def do_static_route(self, arg): """Apply IPv4 static routing configuration on all interfaces Specify no arguments will apply static routing with following config: 1. clients_start - 16.0.0.1 2. servers_start - 48.0.0.1 3. dual_port_mask - 1.0.0.0 4. client_destination_mask - 255.0.0.0 5. server_destination_mask - 255.0.0.0 """ if arg: stat_route_dict = load_object_config_file(arg) # else: # print termstyle.magenta("Unknown configutaion option requested. use 'help static_route' for further info.") else: stat_route_dict = { 'clients_start': '16.0.0.1', 'servers_start': '48.0.0.1', 'dual_port_mask': '1.0.0.0', 'client_destination_mask': '255.0.0.0', 'server_destination_mask': '255.0.0.0' } stat_route_obj = CStaticRouteConfig(stat_route_dict) self.platform.config_static_routing(stat_route_obj) print( termstyle.green( "IPv4 static routing configuration applied successfully."))
def do_static_route(self, arg): """Apply IPv4 static routing configuration on all interfaces Specify no arguments will apply static routing with following config: 1. clients_start - 16.0.0.1 2. servers_start - 48.0.0.1 3. dual_port_mask - 1.0.0.0 4. client_destination_mask - 255.0.0.0 5. server_destination_mask - 255.0.0.0 """ if arg: stat_route_dict = load_object_config_file(arg) # else: # print termstyle.magenta("Unknown configutaion option requested. use 'help static_route' for further info.") else: stat_route_dict = { 'clients_start' : '16.0.0.1', 'servers_start' : '48.0.0.1', 'dual_port_mask': '1.0.0.0', 'client_destination_mask' : '255.0.0.0', 'server_destination_mask' : '255.0.0.0' } stat_route_obj = CStaticRouteConfig(stat_route_dict) self.platform.config_static_routing(stat_route_obj) print(termstyle.green("IPv4 static routing configuration applied successfully."))
def do_nat(self, arg): """Apply NAT configuration on all non-duplicated interfaces Specify no arguments will apply NAT with following config: 1. clients_net_start - 16.0.0.0 2. client_acl_wildcard_mask - 0.0.0.255 3. dual_port_mask - 1.0.0.0 4. pool_start - 200.0.0.0 5. pool_netmask - 255.255.255.0 """ if arg: nat_dict = load_object_config_file(arg) # else: # print termstyle.magenta("Unknown nat configutaion option requested. use 'help nat' for further info.") else: # print termstyle.magenta("Specific nat configutaion is missing. use 'help nat' for further info.") nat_dict = { 'clients_net_start' : '16.0.0.0', 'client_acl_wildcard_mask' : '0.0.0.255', 'dual_port_mask' : '1.0.0.0', 'pool_start' : '200.0.0.0', 'pool_netmask' : '255.255.255.0' } nat_obj = CNatConfig(nat_dict) self.platform.config_nat(nat_obj) print(termstyle.green("NAT configuration applied successfully."))
parser.add_option = parser.add_argument cfg_plugin.options(parser) options, _ = parser.parse_known_args(sys.argv) trex_tests = options.stateless or options.stateful or options.astf or options.bird if not CTRexScenario.is_test_list and (trex_tests or not (trex_tests or options.functional or options.wireless)): if CTRexScenario.setup_dir and options.config_path: fatal('Please either define --cfg or use env. variable SETUP_DIR, not both.') if not options.config_path and CTRexScenario.setup_dir: options.config_path = CTRexScenario.setup_dir if not options.config_path: fatal('Please specify path to config.yaml using --cfg parameter or env. variable SETUP_DIR') options.config_path = options.config_path.rstrip('/') CTRexScenario.setup_name = os.path.basename(options.config_path) CTRexScenario.configuration = misc_methods.load_complete_config_file(os.path.join(options.config_path, 'config.yaml')) CTRexScenario.config_dict = misc_methods.load_object_config_file(os.path.join(options.config_path, 'config.yaml')) CTRexScenario.configuration.trex['trex_name'] = address_to_ip(CTRexScenario.configuration.trex['trex_name']) # translate hostname to ip CTRexScenario.benchmark = misc_methods.load_benchmark_config_file(os.path.join(options.config_path, 'benchmark.yaml')) CTRexScenario.modes = set(CTRexScenario.configuration.trex.get('modes', [])) is_wlc = 'wlc' in CTRexScenario.modes is_bird = 'bird' in CTRexScenario.modes addplugins = [RedNose(), cfg_plugin] result = True try: import coverage except ImportError: pass else: