Exemplo n.º 1
0
        # and set for stomp and ws_stomp modules also
        for stomp_mod in ['stomp', 'ws_stomp', 'pxgrid']:
            s_logger = logging.getLogger(stomp_mod)
            handler.setFormatter(
                logging.Formatter(
                    '%(asctime)s:%(name)s:%(levelname)s:%(message)s'))
            s_logger.addHandler(handler)
            s_logger.setLevel(logging.DEBUG)

    pxgrid = PxgridControl(config=config)

    while pxgrid.account_activate()['accountState'] != 'ENABLED':
        time.sleep(60)

    # lookup for session service
    service_lookup_response = pxgrid.service_lookup(
        'com.cisco.ise.config.trustsec')
    service = service_lookup_response['services'][0]
    node_name = service['nodeName']
    url = service['properties']['restBaseUrl'] + '/getSecurityGroupAcls'

    # force port
    # url = url.replace('8910', str(config.port))

    # log url to see what we get via discovery
    logger.info('Using URL %s', url)

    secret = pxgrid.get_access_secret(node_name)['secret']
    logger.info('Using access secret %s', secret)
    resp = query(config, secret, url, '{}')
    print(json.dumps(json.loads(resp), indent=2, sort_keys=True))
Exemplo n.º 2
0
        logger.setLevel(logging.DEBUG)

        # and set for stomp and ws_stomp modules also
        for stomp_mod in ['stomp', 'ws_stomp', 'pxgrid']:
            s_logger = logging.getLogger(stomp_mod)
            handler.setFormatter(logging.Formatter('%(asctime)s:%(name)s:%(levelname)s:%(message)s'))
            s_logger.addHandler(handler)
            s_logger.setLevel(logging.DEBUG)

    pxgrid = PxgridControl(config=config)

    while pxgrid.account_activate()['accountState'] != 'ENABLED':
        time.sleep(60)

    # lookup for session service
    service_lookup_response = pxgrid.service_lookup('com.cisco.ise.session')
    service = service_lookup_response['services'][0]
    node_name = service['nodeName']
    url = service['properties']['restBaseUrl'] + '/getUserGroups'

    # force port from CLI
    # url = url.replace('8910', str(config.port))
    
    # log url to see what we get via discovery
    logger.info('Using URL %s', url)

    secret = pxgrid.get_access_secret(node_name)['secret']
    logger.info('Using access secret %s', secret)
    if config.start_timestamp:
        payload = {
            'startTimestamp': config.start_timestamp
Exemplo n.º 3
0
                    except Exception:
                        log.exception('')
                        continue
            else:
                print("boo")


if __name__ == '__main__':
    config = Config()
    pxgrid = PxgridControl(config=config)

    while pxgrid.account_activate()['accountState'] != 'ENABLED':
        time.sleep(60)

    # lookup for session service
    service_lookup_response = pxgrid.service_lookup('com.cisco.ise.session')
    service = service_lookup_response['services'][0]
    pubsub_service_name = service['properties']['wsPubsubService']
    topic = service['properties']['sessionTopic']

    # lookup for pubsub service
    service_lookup_response = pxgrid.service_lookup(pubsub_service_name)
    pubsub_service = service_lookup_response['services'][0]
    pubsub_node_name = pubsub_service['nodeName']
    secret = pxgrid.get_access_secret(pubsub_node_name)['secret']
    ws_url = pubsub_service['properties']['wsUrl']

    loop = asyncio.get_event_loop()
    subscribe_task = asyncio.ensure_future(
        subscribe_loop(config, secret, ws_url, topic))
Exemplo n.º 4
0
    # px grid control object and look at either deeper service discovery
    # or just subscribing to what we're asked to subscribe to
    #
    pxgrid = PxgridControl(config=config)

    #
    # in case we need to go appropve in the ISE UI
    #
    while pxgrid.account_activate()['accountState'] != 'ENABLED':
        time.sleep(60)

    # lookup for session service
    if config.services:
        slr_responses = []
        for service in SERVICE_NAMES:
            service_lookup_response = pxgrid.service_lookup(service)
            slr_responses.append(service_lookup_response)

            #
            # log for debug
            #
            slr_string = json.dumps(service_lookup_response, indent=2, sort_keys=True)
            logger.debug('service %s lookup response:', service)
            slr_string = json.dumps(service_lookup_response, indent=2, sort_keys=True)
            logger.debug('service lookup response:')
            for s in slr_string.splitlines():
                logger.debug('  %s', s)

        #
        # dump all services as a json array pretty-printed
        #
Exemplo n.º 5
0
        # and set for stomp and ws_stomp modules also
        for stomp_mod in ['stomp', 'ws_stomp', 'pxgrid']:
            s_logger = logging.getLogger(stomp_mod)
            handler.setFormatter(
                logging.Formatter(
                    '%(asctime)s:%(name)s:%(levelname)s:%(message)s'))
            s_logger.addHandler(handler)
            s_logger.setLevel(logging.DEBUG)

    pxgrid = PxgridControl(config=config)

    while pxgrid.account_activate()['accountState'] != 'ENABLED':
        time.sleep(60)

    # lookup for session service
    service_lookup_response = pxgrid.service_lookup('com.cisco.ise.system')
    service = service_lookup_response['services'][0]
    node_name = service['nodeName']
    url = service['properties']['restBaseUrl'] + '/getPerformances'

    # log url to see what we get via discovery
    logger.info('Using URL %s', url)

    secret = pxgrid.get_access_secret(node_name)['secret']
    logger.info('Using access secret %s', secret)
    if config.start_timestamp:
        payload = {'startTimestamp': config.start_timestamp}
        resp = query(config, secret, url, json.dumps(payload))
    else:
        resp = query(config, secret, url, '{}')
    print(json.dumps(json.loads(resp), indent=2, sort_keys=True))
Exemplo n.º 6
0
        logger.setLevel(logging.DEBUG)

        # and set for stomp and ws_stomp modules also
        for stomp_mod in ['stomp', 'ws_stomp', 'pxgrid']:
            s_logger = logging.getLogger(stomp_mod)
            handler.setFormatter(
                logging.Formatter(
                    '%(asctime)s:%(name)s:%(levelname)s:%(message)s'))
            s_logger.addHandler(handler)
            s_logger.setLevel(logging.DEBUG)

    pxgrid = PxgridControl(config=config)

    while pxgrid.account_activate()['accountState'] != 'ENABLED':
        time.sleep(60)

    # lookup for session service
    service_lookup_response = pxgrid.service_lookup(
        'com.cisco.ise.config.profiler')
    service = service_lookup_response['services'][0]
    node_name = service['nodeName']
    url = service['properties']['restBaseUrl'] + '/getProfiles'

    # log url to see what we get via discovery
    logger.info('Using URL %s', url)

    secret = pxgrid.get_access_secret(node_name)['secret']
    logger.info('Using access secret %s', secret)
    resp = query(config, secret, url, '{}')
    print(json.dumps(json.loads(resp), indent=2, sort_keys=True))