コード例 #1
0
def run_rid_tests(test_configuration: RIDQualifierTestConfiguration,
                  auth_spec: str,
                  flight_records: List[FullFlightRecord]) -> reports.Report:
    my_test_builder = TestBuilder(test_configuration=test_configuration, flight_records=flight_records)
    test_payloads = my_test_builder.build_test_payloads()
    test_id = str(uuid.uuid4())
    report = reports.Report(setup=reports.Setup(configuration=test_configuration))

    # Inject flights into all USSs
    injected_flights = []
    for i, target in enumerate(test_configuration.injection_targets):
      uss_injection_harness = TestHarness(
        auth_spec=auth_spec,
        injection_base_url=target.injection_base_url)
      uss_injection_harness.submit_test(test_payloads[i], test_id, report.setup)
      for flight in test_payloads[i].requested_flights:
        injected_flights.append(InjectedFlight(uss=target, flight=flight))

    # Create observers
    observers: List[display_data_evaluator.RIDSystemObserver] = []
    for observer_config in test_configuration.observers:
        observer = display_data_evaluator.RIDSystemObserver(
            observer_config.name, DSSTestSession(
                observer_config.observation_base_url,
                make_auth_adapter(auth_spec)))
        observers.append(observer)

    # Evaluate observed RID system states
    display_data_evaluator.evaluate_system(
        injected_flights, observers, test_configuration.evaluation,
        report.findings)
    with open('../report.json', 'w') as f:
        json.dump(report, f)
    return report
コード例 #2
0
ファイル: resources.py プロジェクト: charlie-pisuraj/dss
 def from_arguments(cls, args: argparse.Namespace):
     adapter: auth.AuthAdapter = auth.make_auth_adapter(args.auth)
     dss_client = infrastructure.DSSTestSession(args.dss, adapter)
     area: s2sphere.LatLngRect = geo.make_latlng_rect(args.area)
     start_time = datetime.datetime.fromisoformat(args.start_time)
     end_time = start_time + datetime.timedelta(hours=args.trace_hours)
     logger = tracerlog.Logger(
         args.output_folder) if args.output_folder else None
     return ResourceSet(dss_client, area, logger, start_time, end_time)
コード例 #3
0
    def __init__(self, name: str, config: InjectionTargetConfiguration,
                 auth_spec: str):
        self.name = name
        self.config = config
        self.client = infrastructure.DSSTestSession(
            self.config.injection_base_url, auth.make_auth_adapter(auth_spec))

        # Flights injected by this target.
        # Key: flight name
        # Value: flight id
        self.created_flight_ids: Dict[str, str] = {}
コード例 #4
0
ファイル: interop.py プロジェクト: rpai1/dss
def main() -> int:
    args = parseArgs()

    adapter = auth.make_auth_adapter(args.auth)
    dss_clients: Dict[str, infrastructure.DSSTestSession] = {}
    for dss in args.DSS:
        dss_clients[dss] = infrastructure.DSSTestSession(dss, adapter)

    # Begin Tests
    tests = InterOpTestSuite(dss_clients)
    tests.startTest()

    return os.EX_OK
コード例 #5
0
def make_session(pytestconfig, endpoint_suffix: str, auth_option: Optional[str] = None) -> Optional[DSSTestSession]:
  dss_endpoint = pytestconfig.getoption('dss_endpoint')
  if dss_endpoint is None:
    pytest.skip('dss-endpoint option not set')

  auth_adapter = None
  if auth_option:
    auth_spec = pytestconfig.getoption(auth_option)
    if not auth_spec:
      pytest.skip('%s option not set' % auth_option)
    auth_adapter = auth.make_auth_adapter(auth_spec)

  s = DSSTestSession(dss_endpoint + endpoint_suffix, auth_adapter)
  return s
コード例 #6
0
 def from_arguments(cls, args: argparse.Namespace):
     adapter: auth.AuthAdapter = auth.make_auth_adapter(args.auth)
     dss_client = infrastructure.DSSTestSession(args.dss, adapter)
     area: s2sphere.LatLngRect = geo.make_latlng_rect(args.area)
     start_time = datetime.datetime.fromisoformat(args.start_time)
     end_time = start_time + datetime.timedelta(hours=args.trace_hours)
     if args.kml_server and args.kml_folder is None:
         raise ValueError(
             'If --kml-server is specified, --kml-folder must also be specified'
         )
     kml_session = infrastructure.KMLGenerationSession(
         args.kml_server, args.kml_folder) if args.kml_server else None
     logger = tracerlog.Logger(args.output_folder,
                               kml_session) if args.output_folder else None
     return ResourceSet(dss_client, area, logger, start_time, end_time)
コード例 #7
0
 def __init__(self, *args, **kwargs):
     super(USS, self).__init__(*args, **kwargs)
     auth_spec = os.environ.get("AUTH_SPEC")
     oauth_adapter = auth.make_auth_adapter(
         auth_spec) if auth_spec else None
     self.client = DSSClient(self.host, oauth_adapter)
     self.client._locust_environment = self.environment
     if not auth_spec:
         # logging after creation of client so that we surface the error in the UI
         e = Exception(
             "Missing AUTH_SPEC environment variable, please check README")
         self.client.log_exception("Initialization", "Create DSS Client",
                                   time.time(), e)
         # raising exception to not allow things to proceed further
         raise e
     # This is a load tester its acceptable to have all the scopes required to operate anything.
     # We are not testing if the scope is incorrect. We are testing if it can handle the load.
     self.client.default_scopes = [rid.SCOPE_WRITE, rid.SCOPE_READ]
コード例 #8
0
ファイル: resources.py プロジェクト: interuss/dss
from monitoring.monitorlib import auth, infrastructure
from monitoring.mock_uss import webapp
from . import config


utm_client = infrastructure.DSSTestSession(
    webapp.config[config.KEY_DSS_URL],
    auth.make_auth_adapter(webapp.config[config.KEY_AUTH_SPEC]))
コード例 #9
0
ファイル: get_access_token.py プロジェクト: rpai1/dss
def get_access_token(spec: str, scopes: str, audience: str):
    adapter = auth.make_auth_adapter(spec)
    return adapter.issue_token(audience, scopes.split(' '))
コード例 #10
0
    def __init__(self, auth_spec:str, injection_base_url:str):

        auth_adapter = make_auth_adapter(auth_spec)
        self._base_url = injection_base_url
        self.uss_session = DSSTestSession(injection_base_url, auth_adapter)
コード例 #11
0
ファイル: resources.py プロジェクト: OneSkySystems/dss
from monitoring.monitorlib import auth, infrastructure
from monitoring.mock_ridsp import webapp
from . import config

dss_client = infrastructure.DSSTestSession(
    webapp.config.get(config.KEY_DSS_URL),
    auth.make_auth_adapter(webapp.config.get(config.KEY_AUTH_SPEC)))