def test_query():
    url = os.environ['TEST_DME_SERVER']
    username = os.environ['TEST_DME_SERVER_USERNAME']
    password = os.environ['TEST_DME_SERVER_PASSWORD']
    snapshotId = os.environ['TEST_DME_SNAPSHOT_ID']
    verify = True
    api = FwdApi(url, (username, password), verify)
    dataset = api.query(snapshotId, query)
    assert len(dataset['devices']) == 118
                    help="The username of an account on the above-specified "
                    "Forward Networks instance.")
parser.add_argument("password",
                    help="The password of an account on the above-specified "
                    "Forward Networks instance.")
parser.add_argument("snapshotId",
                    help="The snapshotId of a snapshot on the above-specified "
                    "Forward Networks instance.")
parser.add_argument("--verify",
                    help="Whether to verify the certificate on the instance "
                    "(e.g. True or False)",
                    action="store_true")
args = parser.parse_args()

# API to query Forward NQE API
api = FwdApi(args.url, (args.username, args.password), args.verify)

# Query to get device interface and VRF data.
query = '''
{
  devices {
    name

    # IP addresses for interfaces, located in the subinterfaces.
    interfaces {
      name
      adminStatus
      subinterfaces {
        name
        adminStatus
        ipv4 {
                    help="The password of an account on the above-specified "
                    "Forward Networks instance.")
parser.add_argument("snapshotId",
                    help="The snapshotId of a snapshot on the above-specified "
                    "Forward Networks instance.")
parser.add_argument("--verify",
                    help="Whether to verify the certificate on the instance "
                    "(e.g. True or False)",
                    action="store_true")
args = parser.parse_args()

if not args.verify:
    urllib3.disable_warnings()

# API to query Forward NQE API
api = FwdApi(args.url, (args.username, args.password), args.verify)

# Query to get all devices' default network-instance and a page of its mac
# entries.
query = '''
query macQuery($deviceName: String, $cursor: String) {
  devices(name: $deviceName) {
    name
    networkInstances(name: "default") {
      fdb {
        macEntriesPage(after: $cursor) {
          items {
            macAddress
            vlan
            interfaces {
              interfaceName
Exemplo n.º 4
0
    "password",
    help="The password of an account on the above-specified "
         "Forward Networks instance.")
parser.add_argument(
    "snapshotId",
    help="The snapshotId of a snapshot on the above-specified "
         "Forward Networks instance.")
parser.add_argument(
    "--verify",
    help="Whether to verify the certificate on the instance "
         "(e.g. True or False)",
    action="store_true")
args = parser.parse_args()

# API to query Forward Data Model Export GraphQL API
api = FwdApi(args.url, (args.username, args.password), args.verify)

# Query to get device interface and VRF data.
platformQuery = '''
{
  devices{
    platform{
      vendor
      model
      osVersion
    }
  }
}
'''

# Query the API