Esempio n. 1
0
 def test_negative(self, driver: StcControllerShell2GDriver,
                   context: ResourceCommandContext) -> None:
     reservation_ports = get_resources_from_reservation(
         context, "STC Chassis Shell 2G.GenericTrafficGeneratorPort")
     assert len(reservation_ports) == 2
     set_family_attribute(context, reservation_ports[0].Name,
                          "Logical Name", "Port 1")
     set_family_attribute(context, reservation_ports[1].Name,
                          "Logical Name", "")
     with pytest.raises(TgnError):
         driver.load_config(
             context,
             Path(__file__).parent.joinpath("test_config.tcc"))
     set_family_attribute(context, reservation_ports[1].Name,
                          "Logical Name", "Port 1")
     with pytest.raises(TgnError):
         driver.load_config(
             context,
             Path(__file__).parent.joinpath("test_config.tcc"))
     set_family_attribute(context, reservation_ports[1].Name,
                          "Logical Name", "Port x")
     with pytest.raises(TgnError):
         driver.load_config(
             context,
             Path(__file__).parent.joinpath("test_config.tcc"))
     set_family_attribute(context, reservation_ports[1].Name,
                          "Logical Name", "Port 2")
Esempio n. 2
0
def context(session: CloudShellAPISession, test_helpers: TestHelpers,
            server: list) -> ResourceCommandContext:
    controller_address, controller_version, apikey, ports = server
    attributes = [
        AttributeNameValue(f'{IXLOAD_CONTROLLER_MODEL}.Address',
                           controller_address),
        AttributeNameValue(f'{IXLOAD_CONTROLLER_MODEL}.Controller Version',
                           controller_version),
        AttributeNameValue(f'{IXLOAD_CONTROLLER_MODEL}.ApiKey', apikey),
        AttributeNameValue(f'{IXLOAD_CONTROLLER_MODEL}.License Server',
                           '192.168.42.61'),
        AttributeNameValue(f'{IXLOAD_CONTROLLER_MODEL}.Licensing Mode',
                           'Perpetual')
    ]
    session.AddServiceToReservation(test_helpers.reservation_id,
                                    IXLOAD_CONTROLLER_MODEL, ALIAS, attributes)
    context = test_helpers.resource_command_context(service_name=ALIAS)
    session.AddResourcesToReservation(test_helpers.reservation_id, ports)
    reservation_ports = get_resources_from_reservation(
        context, f'{IXIA_CHASSIS_MODEL}.GenericTrafficGeneratorPort')
    set_family_attribute(context, reservation_ports[0].Name, 'Logical Name',
                         'Traffic1@Network1')
    set_family_attribute(context, reservation_ports[1].Name, 'Logical Name',
                         'Traffic2@Network2')
    yield context
Esempio n. 3
0
 def _load_config(
     self,
     driver: StcControllerShell2GDriver,
     context: ResourceCommandContext,
     config_file: Path,
 ) -> None:
     reservation_ports = get_resources_from_reservation(
         context, f"{STC_CHASSIS_MODEL}.GenericTrafficGeneratorPort")
     set_family_attribute(context, reservation_ports[0].Name,
                          "Logical Name", "Port 1")
     set_family_attribute(context, reservation_ports[1].Name,
                          "Logical Name", "Port 2")
     driver.load_config(context, config_file.as_posix())
Esempio n. 4
0
 def _load_config(
     self,
     session: CloudShellAPISession,
     context: ResourceCommandContext,
     config: Path,
 ) -> None:
     reservation_ports = get_resources_from_reservation(
         context, "STC Chassis Shell 2G.GenericTrafficGeneratorPort")
     set_family_attribute(context, reservation_ports[0].Name,
                          "Logical Name", "Port 1")
     set_family_attribute(context, reservation_ports[1].Name,
                          "Logical Name", "Port 2")
     cmd_inputs = [
         InputNameValue("config_file_location", config.as_posix())
     ]
     session.ExecuteCommand(get_reservation_id(context), ALIAS, "Service",
                            "load_config", cmd_inputs)
Esempio n. 5
0
def context(session: CloudShellAPISession, test_helpers: TestHelpers,
            server: list) -> ResourceCommandContext:
    controller_address, controller_port, ports = server
    attributes = [
        AttributeNameValue(f"{STC_CONTROLLER_MODEL}.Address",
                           controller_address),
        AttributeNameValue(f"{STC_CONTROLLER_MODEL}.Controller TCP Port",
                           controller_port),
    ]
    session.AddServiceToReservation(test_helpers.reservation_id,
                                    STC_CONTROLLER_MODEL, ALIAS, attributes)
    context = test_helpers.resource_command_context(service_name=ALIAS)
    session.AddResourcesToReservation(test_helpers.reservation_id, ports)
    reservation_ports = get_resources_from_reservation(
        context, f"{STC_CHASSIS_MODEL}.GenericTrafficGeneratorPort")
    set_family_attribute(context, reservation_ports[0].Name, "Logical Name",
                         "Port 1")
    set_family_attribute(context, reservation_ports[1].Name, "Logical Name",
                         "Port 2")
    yield context