From 6861e6d742291ea3a68a67c8fc56cd84c9a7daa3 Mon Sep 17 00:00:00 2001 From: mischa Date: Fri, 17 Jun 2022 12:45:57 +0200 Subject: [PATCH] things! --- .gitignore | 2 +- awsvpcconnectors.txt | 36 -- clean.py | 16 +- config-20220614.txt | 880 -------------------------------- config/awsvpcconnectors1.txt | 16 + config/awsvpcconnectors2.txt | 16 + config/azurevnetconnectors1.txt | 18 + config/azurevnetconnectors2.txt | 18 + config/azurevnetconnectors3.txt | 18 + config/azurevnetconnectors4.txt | 18 + config/connectors.cnf | 41 ++ config/ipsecconnectors1.txt | 28 + get.py | 22 +- push-debug.py | 22 +- push.py | 119 +++-- validate-json.py | 4 +- 16 files changed, 284 insertions(+), 990 deletions(-) delete mode 100644 awsvpcconnectors.txt delete mode 100644 config-20220614.txt create mode 100644 config/awsvpcconnectors1.txt create mode 100644 config/awsvpcconnectors2.txt create mode 100644 config/azurevnetconnectors1.txt create mode 100644 config/azurevnetconnectors2.txt create mode 100644 config/azurevnetconnectors3.txt create mode 100644 config/azurevnetconnectors4.txt create mode 100644 config/connectors.cnf create mode 100644 config/ipsecconnectors1.txt diff --git a/.gitignore b/.gitignore index e44b061..0c0881a 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1 @@ -*.cnf +alkira.cnf diff --git a/awsvpcconnectors.txt b/awsvpcconnectors.txt deleted file mode 100644 index af7652d..0000000 --- a/awsvpcconnectors.txt +++ /dev/null @@ -1,36 +0,0 @@ -[ - { - "customerName": "AlkiraEMEA_US-East2-1-vpc", - "customerRegion": "us-east-2", - "vpcId": "vpc-052769d7efd0e75eb", - "vpcOwnerId": "138319602003", - "credentialId": "b269e6d7-2b7d-45dc-9fb5-5ac1f49db139", - "segments": [ - "Corporate" - ], - "size": "MEDIUM", - "name": "AlkiraEMEA_US-East2-2-vpc", - "cxp": "US-EAST-2", - "group": "Users", - "billingTags": [ - "333" - ], - }, - { - "customerName": "AlkiraEMEA_US-East2-2-vpc", - "customerRegion": "us-east-2", - "vpcId": "vpc-007815b7e755ac4b3", - "vpcOwnerId": "138319602003", - "credentialId": "b269e6d7-2b7d-45dc-9fb5-5ac1f49db139", - "segments": [ - "Corporate" - ], - "size": "MEDIUM", - "name": "AlkiraEMEA_US-East2-2-vpc", - "cxp": "US-EAST-2", - "group": "Users", - "billingTags": [ - "333" - ], - } -] diff --git a/clean.py b/clean.py index 89acdf2..98e4f53 100755 --- a/clean.py +++ b/clean.py @@ -11,16 +11,16 @@ import configparser ############################################### -CONFIG_FILE = "/Users/mischa/Alkira/xDev/alkira.cnf" -if not os.path.isfile(CONFIG_FILE): - logging.error(f"The config file {CONFIG_FILE} doesn't exist") +ALKIRA_CONFIG= "/Users/mischa/Alkira/xDev/alkira.cnf" +if not os.path.isfile(ALKIRA_CONFIG): + logging.error(f"The config file {ALKIRA_CONFIG} doesn't exist") sys.exit(1) -config = configparser.RawConfigParser() -config.read(CONFIG_FILE) +alkira = configparser.RawConfigParser() +alkira.read(ALKIRA_CONFIG) -ALKIRA_TENANT = config.get('alkira', 'ALKIRA_TENANT') -ALKIRA_USERNAME = config.get('alkira', 'ALKIRA_USERNAME') -ALKIRA_PASSWORD = config.get('alkira', 'ALKIRA_PASSWORD') +ALKIRA_TENANT = alkira.get('alkira', 'ALKIRA_TENANT') +ALKIRA_USERNAME = alkira.get('alkira', 'ALKIRA_USERNAME') +ALKIRA_PASSWORD = alkira.get('alkira', 'ALKIRA_PASSWORD') ALKIRA_BASE_URI = f'https://{ALKIRA_TENANT}/api' ############################################### diff --git a/config-20220614.txt b/config-20220614.txt deleted file mode 100644 index 0132ae1..0000000 --- a/config-20220614.txt +++ /dev/null @@ -1,880 +0,0 @@ -# Connectors -[ - { - "id": 13090, - "tenantId": 70, - "tenantNetworkId": 53, - "name": "alkiraemea-eu-west1-2-vpc@europe-west1", - "internalName": "con-gcp_vpc-bbab13f9-8d70-4465-b7b6-6c76427f", - "cxp": "GERMANYWESTCENTRAL-AZURE-1", - "cxpId": "0de2b1c2-3544-416c-976f-98b792953e73", - "type": "GCP_VPC", - "productId": "d39eca50-9412-4d5e-a16d-b366f6f52c56", - "group": "Development", - "groupId": 17622, - "tagId": 65508, - "tags": [ - 65508 - ], - "implicitGroupId": 25560, - "segments": [ - "Pre Prod" - ], - "extraAttributes": { - "customerRegion": "europe-west1", - "vpcId": "305769359309508740", - "vpcName": "alkiraemea-eu-west1-2-vpc", - "credentialId": "f273a2dc-d8bb-4106-b66c-53398b5551b1", - "routingMode": "REGIONAL", - "gcpRouting": { - "importFromCXPOptions": { - "prefixListIds": [], - "routeImportMode": "ADVERTISE_DEFAULT_ROUTE" - } - } - }, - "groupType": "APP", - "instances": [], - "state": "PENDING", - "size": "MEDIUM", - "segmentOptions": {}, - "asn": 64522, - "docState": "ADDED", - "deletedAt": -1, - "configAvailable": false, - "billingTags": [], - "segmentIds": [ - 1638 - ], - "lastConfigUpdatedAt": 1655234944045, - "anyCPLId": 8847, - "enabled": true, - "primary": true, - "userGroups": [] - }, - { - "id": 13089, - "tenantId": 70, - "tenantNetworkId": 53, - "name": "alkiraemea-eu-west1-1-vpc@europe-west1", - "internalName": "con-gcp_vpc-450edd7c-5dd5-4e32-a416-9b3aa780", - "cxp": "GERMANYWESTCENTRAL-AZURE-1", - "cxpId": "0de2b1c2-3544-416c-976f-98b792953e73", - "type": "GCP_VPC", - "productId": "d39eca50-9412-4d5e-a16d-b366f6f52c56", - "group": "Development", - "groupId": 17622, - "tagId": 65509, - "tags": [ - 65509 - ], - "implicitGroupId": 25559, - "segments": [ - "Pre Prod" - ], - "extraAttributes": { - "customerRegion": "europe-west1", - "vpcId": "611487575275180700", - "vpcName": "alkiraemea-eu-west1-1-vpc", - "credentialId": "f273a2dc-d8bb-4106-b66c-53398b5551b1", - "routingMode": "REGIONAL", - "gcpRouting": { - "importFromCXPOptions": { - "prefixListIds": [], - "routeImportMode": "ADVERTISE_DEFAULT_ROUTE" - } - } - }, - "groupType": "APP", - "instances": [], - "state": "PENDING", - "size": "MEDIUM", - "segmentOptions": {}, - "asn": 64522, - "docState": "ADDED", - "deletedAt": -1, - "configAvailable": false, - "billingTags": [], - "segmentIds": [ - 1638 - ], - "lastConfigUpdatedAt": 1655234941736, - "anyCPLId": 8846, - "enabled": true, - "primary": true, - "userGroups": [] - }, - { - "id": 13088, - "tenantId": 70, - "tenantNetworkId": 53, - "name": "Amsterdam-PreProd", - "internalName": "con-ip_sec-6e774600-63d8-475a-a42f-a0f7c96d", - "cxp": "US-EAST-2", - "cxpId": "4e6c5c71-4e02-4f81-90c6-effbf8d50b7f", - "type": "IP_SEC", - "productId": "42afee03-8d4e-4f07-93e5-b88f672e0114", - "group": "Development", - "groupId": 17622, - "tagId": 65511, - "tags": [ - 65511 - ], - "implicitGroupId": 25558, - "segments": [ - "Pre Prod" - ], - "extraAttributes": { - "vpnMode": "ROUTE_BASED", - "routingOptions": { - "staticRouting": null, - "dynamicRouting": { - "customerGwAsn": "60131", - "bgpAuthKeyAlkira": "" - } - } - }, - "groupType": "USER", - "instances": [ - { - "id": 3790, - "tenantId": 70, - "tenantNetworkId": 53, - "connectorId": 13088, - "productId": "42afee03-8d4e-4f07-93e5-b88f672e0114", - "state": "PENDING", - "name": "Fortigate2", - "internalName": "coni-ip_sec-824d1ee9-000c-4c74-8076-bbc092c8", - "extraAttributes": { - "gatewayIpType": "STATIC", - "customerGwIp": "111.1.1.1", - "presharedKeys": [ - { - "uid": "tunnel-IP_SEC-d853fb33-6cc2-4d1e-8720-6dc83794223a", - "secret": "9e18bd16-a267-43ef-94e8-d332386e0909", - "id": 39071881, - "tunnelNo": 0 - }, - { - "uid": "tunnel-IP_SEC-f5f2b6ce-3590-49e9-b1e4-1352f3bb400c", - "secret": "ed81f101-45fc-4d1e-a171-f3700d9f339f", - "id": 74187978, - "tunnelNo": 1 - } - ] - }, - "cxp": "US-EAST-2", - "docState": "ADDED", - "deletedAt": -1, - "configAvailable": false, - "billingTags": [ - 343 - ], - "lastConfigUpdatedAt": 1655234913330, - "enableTunnelRedundancy": true, - "networkEntityType": "CONNECTOR_INSTANCE" - } - ], - "state": "PENDING", - "size": "MEDIUM", - "segmentOptions": { - "Pre Prod": { - "segmentId": 1638, - "disableInternetExit": false, - "advertiseOnPremRoutes": false - } - }, - "docState": "ADDED", - "deletedAt": -1, - "configAvailable": false, - "billingTags": [], - "segmentIds": [ - 1638 - ], - "lastConfigUpdatedAt": 1655234913460, - "anyCPLId": 8845, - "enabled": true, - "primary": true, - "userGroups": [] - }, - { - "id": 13087, - "tenantId": 70, - "tenantNetworkId": 53, - "name": "Amsterdam", - "internalName": "con-ip_sec-eedbd9d4-7b3c-4334-96a0-c9e2de0b", - "cxp": "US-EAST-2", - "cxpId": "4e6c5c71-4e02-4f81-90c6-effbf8d50b7f", - "type": "IP_SEC", - "productId": "03d59526-ad52-454b-a675-341a57a8798b", - "group": "Users", - "groupId": 19104, - "tagId": 65517, - "tags": [ - 65517 - ], - "implicitGroupId": 25555, - "segments": [ - "Corporate" - ], - "extraAttributes": { - "vpnMode": "ROUTE_BASED", - "routingOptions": { - "staticRouting": null, - "dynamicRouting": { - "customerGwAsn": "60131", - "bgpAuthKeyAlkira": "" - } - } - }, - "groupType": "USER", - "instances": [ - { - "id": 3789, - "tenantId": 70, - "tenantNetworkId": 53, - "connectorId": 13087, - "productId": "03d59526-ad52-454b-a675-341a57a8798b", - "state": "PENDING", - "name": "Fortigate", - "internalName": "coni-ip_sec-02c5bd23-12d6-416d-8b08-cdf79994", - "extraAttributes": { - "gatewayIpType": "STATIC", - "customerGwIp": "101.1.1.1", - "presharedKeys": [ - { - "uid": "tunnel-IP_SEC-c5c4dd9b-7c07-4e49-a537-ae151b9db0b8", - "secret": "79dab2f5-ad3a-44ed-9287-da65af1f467b", - "id": 77871682, - "tunnelNo": 0 - }, - { - "uid": "tunnel-IP_SEC-ba08b988-071b-4750-8e42-1d7994db5246", - "secret": "9134ffcf-37c2-48a3-ae6e-c96333522c3e", - "id": 45687122, - "tunnelNo": 1 - } - ] - }, - "cxp": "US-EAST-2", - "docState": "ADDED", - "deletedAt": -1, - "configAvailable": false, - "billingTags": [ - 333 - ], - "lastConfigUpdatedAt": 1655234826614, - "enableTunnelRedundancy": true, - "networkEntityType": "CONNECTOR_INSTANCE" - } - ], - "state": "PENDING", - "size": "LARGE", - "segmentOptions": { - "Corporate": { - "segmentId": 1636, - "disableInternetExit": false, - "advertiseOnPremRoutes": false - } - }, - "docState": "ADDED", - "deletedAt": -1, - "configAvailable": false, - "billingTags": [], - "segmentIds": [ - 1636 - ], - "lastConfigUpdatedAt": 1655234826663, - "anyCPLId": 8844, - "enabled": true, - "primary": true, - "userGroups": [] - }, - { - "id": 13086, - "tenantId": 70, - "tenantNetworkId": 53, - "name": "Internet", - "description": "", - "internalName": "con-saas-f932e08c-2749-4eae-8ecc-e2f8497d", - "cxp": "US-EAST-2", - "cxpId": "4e6c5c71-4e02-4f81-90c6-effbf8d50b7f", - "type": "SAAS", - "productId": "1e3c0b38-6d21-4ee2-9b99-0ac71e9a8a2b", - "tagId": 65518, - "tags": [ - 65518 - ], - "implicitGroupId": 25554, - "segments": [ - "Corporate" - ], - "extraAttributes": { - "trafficDistribution": { - "algorithm": "HASHING", - "algorithmAttributes": { - "keys": "DEFAULT" - } - }, - "numOfPublicIPs": 2 - }, - "groupType": "NONE", - "instances": [], - "state": "PENDING", - "size": "SMALL", - "segmentOptions": {}, - "docState": "ADDED", - "deletedAt": -1, - "configAvailable": false, - "billingTags": [], - "segmentIds": [ - 1636 - ], - "lastConfigUpdatedAt": 1655234801476, - "anyCPLId": 8843, - "enabled": true, - "primary": true, - "userGroups": [] - }, - { - "id": 13085, - "tenantId": 70, - "tenantNetworkId": 53, - "name": "AlkiraEMEA_US-East2-2-vpc", - "internalName": "con-aws_vpc-80ac45b9-07e6-457f-ab6e-0bd49639", - "cxp": "US-EAST-2", - "cxpId": "4e6c5c71-4e02-4f81-90c6-effbf8d50b7f", - "owner": "138319602003", - "type": "AWS_VPC", - "productId": "a961dc4f-b9c3-44e2-8b57-c687f9315525", - "group": "Users", - "groupId": 19104, - "tagId": 65519, - "tags": [ - 65519 - ], - "implicitGroupId": 25553, - "segments": [ - "Corporate" - ], - "extraAttributes": { - "vpcId": "vpc-007815b7e755ac4b3", - "vpcOwnerId": "138319602003", - "customerName": "AlkiraEMEA_US-East2-2-vpc", - "customerRegion": "us-east-2", - "credentialId": "b269e6d7-2b7d-45dc-9fb5-5ac1f49db139", - "vpcRouting": { - "exportToCXPOptions": { - "userInputPrefixes": [ - { - "id": null, - "value": "10.31.14.0/24", - "type": "CIDR" - } - ], - "routeExportMode": "USER_INPUT_PREFIXES" - }, - "importFromCXPOptions": { - "routeTables": [ - { - "id": "rtb-0725237d67e9c144c", - "prefixListIds": [], - "routeImportMode": "ADVERTISE_DEFAULT_ROUTE" - }, - { - "id": "rtb-052b46526e924c46e", - "prefixListIds": [], - "routeImportMode": "ADVERTISE_DEFAULT_ROUTE" - }, - { - "id": "rtb-0867b93e8e31f116a", - "prefixListIds": [], - "routeImportMode": "ADVERTISE_DEFAULT_ROUTE" - } - ] - } - }, - "superNetToSubnetPrefixes": { - "10.31.14.0/24": [ - { - "subnetId": "subnet-0247046cadba37ddf", - "prefix": "10.31.14.144/28" - }, - { - "subnetId": "subnet-078f5469a2687e68a", - "prefix": "10.31.14.128/28" - } - ] - }, - "directInterVPCCommunicationEnabled": false, - "awsVpcSelection": { - "id": "vpc-007815b7e755ac4b3", - "name": "AlkiraEMEA_US-East2-2-vpc", - "cidrs": [ - { - "prefix": "10.31.14.0/24", - "docState": "SELECTED" - } - ], - "routeTables": [ - { - "id": "rtb-0725237d67e9c144c", - "name": "AlkiraEMEA_US-East2-2-rtb-private2-us-east-2b", - "subnets": [ - { - "id": "subnet-0247046cadba37ddf", - "name": "AlkiraEMEA_US-East2-2-subnet-private2-us-east-2b", - "prefix": "10.31.14.144/28", - "supernetPrefix": "10.31.14.0/24", - "routeTableId": "rtb-0725237d67e9c144c", - "docState": "SELECTED", - "availabilityZoneName": "us-east-2b", - "availabilityZoneId": "use2-az2" - } - ], - "docState": "SELECTED", - "routes": null - }, - { - "id": "rtb-052b46526e924c46e", - "name": "AlkiraEMEA_US-East2-2-rtb-private1-us-east-2a", - "subnets": [ - { - "id": "subnet-078f5469a2687e68a", - "name": "AlkiraEMEA_US-East2-2-subnet-private1-us-east-2a", - "prefix": "10.31.14.128/28", - "supernetPrefix": "10.31.14.0/24", - "routeTableId": "rtb-052b46526e924c46e", - "docState": "SELECTED", - "availabilityZoneName": "us-east-2a", - "availabilityZoneId": "use2-az1" - } - ], - "docState": "SELECTED", - "routes": null - }, - { - "id": "rtb-0867b93e8e31f116a", - "name": null, - "subnets": [], - "docState": "AVAILABLE", - "routes": null - } - ], - "changed": false, - "ownerId": "138319602003" - } - }, - "groupType": "APP", - "instances": [], - "state": "PENDING", - "size": "MEDIUM", - "segmentOptions": {}, - "asn": 64520, - "docState": "ADDED", - "deletedAt": -1, - "configAvailable": false, - "billingTags": [ - 333 - ], - "segmentIds": [ - 1636 - ], - "lastConfigUpdatedAt": 1655234791980, - "anyCPLId": 8842, - "enabled": true, - "primary": true, - "secondaryCXPs": [], - "userGroups": [] - }, - { - "id": 13084, - "tenantId": 70, - "tenantNetworkId": 53, - "name": "AlkiraEMEA_US-East2-1-vpc", - "internalName": "con-aws_vpc-e2d1dbb5-91d3-4f18-a64b-d6b0975a", - "cxp": "US-EAST-2", - "cxpId": "4e6c5c71-4e02-4f81-90c6-effbf8d50b7f", - "owner": "138319602003", - "type": "AWS_VPC", - "productId": "a961dc4f-b9c3-44e2-8b57-c687f9315525", - "group": "Users", - "groupId": 19104, - "tagId": 65521, - "tags": [ - 65521 - ], - "implicitGroupId": 25552, - "segments": [ - "Corporate" - ], - "extraAttributes": { - "vpcId": "vpc-052769d7efd0e75eb", - "vpcOwnerId": "138319602003", - "customerName": "AlkiraEMEA_US-East2-1-vpc", - "customerRegion": "us-east-2", - "credentialId": "b269e6d7-2b7d-45dc-9fb5-5ac1f49db139", - "vpcRouting": { - "exportToCXPOptions": { - "userInputPrefixes": [ - { - "id": null, - "value": "10.31.13.0/24", - "type": "CIDR" - } - ], - "routeExportMode": "USER_INPUT_PREFIXES" - }, - "importFromCXPOptions": { - "routeTables": [ - { - "id": "rtb-007377c55bd84971a", - "prefixListIds": [], - "routeImportMode": "ADVERTISE_DEFAULT_ROUTE" - }, - { - "id": "rtb-0bab1f83d45d9a424", - "prefixListIds": [], - "routeImportMode": "ADVERTISE_DEFAULT_ROUTE" - }, - { - "id": "rtb-0ebb13fef05d78fd0", - "prefixListIds": [], - "routeImportMode": "ADVERTISE_DEFAULT_ROUTE" - } - ] - } - }, - "superNetToSubnetPrefixes": { - "10.31.13.0/24": [ - { - "subnetId": "subnet-05c55e49dc38096f1", - "prefix": "10.31.13.144/28" - }, - { - "subnetId": "subnet-0aa8735600e91f754", - "prefix": "10.31.13.128/28" - } - ] - }, - "directInterVPCCommunicationEnabled": false, - "awsVpcSelection": { - "id": "vpc-052769d7efd0e75eb", - "name": "AlkiraEMEA_US-East2-1-vpc", - "cidrs": [ - { - "prefix": "10.31.13.0/24", - "docState": "SELECTED" - } - ], - "routeTables": [ - { - "id": "rtb-007377c55bd84971a", - "name": "AlkiraEMEA_US-East2-1-rtb-private2-us-east-2b", - "subnets": [ - { - "id": "subnet-05c55e49dc38096f1", - "name": "AlkiraEMEA_US-East2-1-subnet-private2-us-east-2b", - "prefix": "10.31.13.144/28", - "supernetPrefix": "10.31.13.0/24", - "routeTableId": "rtb-007377c55bd84971a", - "docState": "SELECTED", - "availabilityZoneName": "us-east-2b", - "availabilityZoneId": "use2-az2" - } - ], - "docState": "SELECTED", - "routes": null - }, - { - "id": "rtb-0bab1f83d45d9a424", - "name": null, - "subnets": [], - "docState": "AVAILABLE", - "routes": null - }, - { - "id": "rtb-0ebb13fef05d78fd0", - "name": "AlkiraEMEA_US-East2-1-rtb-private1-us-east-2a", - "subnets": [ - { - "id": "subnet-0aa8735600e91f754", - "name": "AlkiraEMEA_US-East2-1-subnet-private1-us-east-2a", - "prefix": "10.31.13.128/28", - "supernetPrefix": "10.31.13.0/24", - "routeTableId": "rtb-0ebb13fef05d78fd0", - "docState": "SELECTED", - "availabilityZoneName": "us-east-2a", - "availabilityZoneId": "use2-az1" - } - ], - "docState": "SELECTED", - "routes": null - } - ], - "changed": false, - "ownerId": "138319602003" - } - }, - "groupType": "APP", - "instances": [], - "state": "PENDING", - "size": "MEDIUM", - "segmentOptions": {}, - "asn": 64520, - "docState": "ADDED", - "deletedAt": -1, - "configAvailable": false, - "billingTags": [ - 333 - ], - "segmentIds": [ - 1636 - ], - "lastConfigUpdatedAt": 1655234789755, - "anyCPLId": 8841, - "enabled": true, - "primary": true, - "secondaryCXPs": [], - "userGroups": [] - }, - { - "id": 13083, - "tenantId": 70, - "tenantNetworkId": 53, - "name": "AlkiraEMEA_EU-North1-2-vnet-AlkiraEMEA_Demo-4efe155c-a0d1-4807-8c32-813b7894c342", - "internalName": "con-azure_vn-05c1ceff-1dee-4fda-a1b3-8b730482", - "cxp": "US-EAST-2", - "cxpId": "4e6c5c71-4e02-4f81-90c6-effbf8d50b7f", - "type": "AZURE_VNET", - "productId": "b7cf1adb-1cd1-4526-bc06-39136868f710", - "group": "Users", - "groupId": 19104, - "tagId": 65523, - "tags": [ - 65523 - ], - "implicitGroupId": 25551, - "segments": [ - "Corporate" - ], - "extraAttributes": { - "vnetId": "/subscriptions/4efe155c-a0d1-4807-8c32-813b7894c342/resourceGroups/AlkiraEMEA_Demo/providers/Microsoft.Network/virtualNetworks/AlkiraEMEA_EU-North1-2-vnet", - "customerRegion": "northeurope", - "gatewaySubnetPrefix": "10.32.43.0/27", - "credentialId": "91f5e4cb-0fec-41a3-bf91-cf06ef3943bd", - "resourceGroupName": "AlkiraEMEA_Demo", - "nativeServices": [], - "vnetRouting": { - "exportToCXPOptions": { - "userInputPrefixes": null - }, - "importFromCXPOptions": { - "prefixListIds": [], - "routeImportMode": "ADVERTISE_DEFAULT_ROUTE", - "cidrs": null, - "subnets": null - }, - "serviceRoutes": { - "cidrs": null, - "subnets": null - } - }, - "subscriptionId": "4efe155c-a0d1-4807-8c32-813b7894c342", - "deploymentMode": "VGW", - "superNetToSubnetPrefixes": { - "10.32.42.0/23": [ - { - "subnetId": "/subscriptions/4efe155c-a0d1-4807-8c32-813b7894c342/resourceGroups/AlkiraEMEA_Demo/providers/Microsoft.Network/virtualNetworks/AlkiraEMEA_EU-North1-2-vnet/subnets/second", - "prefix": "10.32.42.128/25" - }, - { - "subnetId": "/subscriptions/4efe155c-a0d1-4807-8c32-813b7894c342/resourceGroups/AlkiraEMEA_Demo/providers/Microsoft.Network/virtualNetworks/AlkiraEMEA_EU-North1-2-vnet/subnets/default", - "prefix": "10.32.42.0/25" - } - ] - }, - "serviceTags": [] - }, - "groupType": "APP", - "instances": [], - "state": "PENDING", - "size": "LARGE", - "segmentOptions": {}, - "asn": 64521, - "docState": "ADDED", - "deletedAt": -1, - "configAvailable": false, - "billingTags": [ - 343 - ], - "segmentIds": [ - 1636 - ], - "lastConfigUpdatedAt": 1655234763460, - "anyCPLId": 8840, - "enabled": true, - "primary": true, - "secondaryCXPs": [], - "userGroups": [] - }, - { - "id": 13082, - "tenantId": 70, - "tenantNetworkId": 53, - "name": "AlkiraEMEA_EU-North1-1-vnet-AlkiraEMEA_Demo-4efe155c-a0d1-4807-8c32-813b7894c342", - "internalName": "con-azure_vn-213c1a79-030d-4f9e-8078-c1cec6e0", - "cxp": "US-EAST-2", - "cxpId": "4e6c5c71-4e02-4f81-90c6-effbf8d50b7f", - "type": "AZURE_VNET", - "productId": "b7cf1adb-1cd1-4526-bc06-39136868f710", - "group": "Users", - "groupId": 19104, - "tagId": 65524, - "tags": [ - 65524 - ], - "implicitGroupId": 25550, - "segments": [ - "Corporate" - ], - "extraAttributes": { - "vnetId": "/subscriptions/4efe155c-a0d1-4807-8c32-813b7894c342/resourceGroups/AlkiraEMEA_Demo/providers/Microsoft.Network/virtualNetworks/AlkiraEMEA_EU-North1-1-vnet", - "customerRegion": "northeurope", - "gatewaySubnetPrefix": "10.32.40.128/27", - "credentialId": "91f5e4cb-0fec-41a3-bf91-cf06ef3943bd", - "resourceGroupName": "AlkiraEMEA_Demo", - "nativeServices": [], - "vnetRouting": { - "exportToCXPOptions": { - "userInputPrefixes": null - }, - "importFromCXPOptions": { - "prefixListIds": [], - "routeImportMode": "ADVERTISE_DEFAULT_ROUTE", - "cidrs": null, - "subnets": null - }, - "serviceRoutes": { - "cidrs": null, - "subnets": null - } - }, - "subscriptionId": "4efe155c-a0d1-4807-8c32-813b7894c342", - "deploymentMode": "VGW", - "superNetToSubnetPrefixes": { - "10.32.40.0/23": [ - { - "subnetId": "/subscriptions/4efe155c-a0d1-4807-8c32-813b7894c342/resourceGroups/AlkiraEMEA_Demo/providers/Microsoft.Network/virtualNetworks/AlkiraEMEA_EU-North1-1-vnet/subnets/default", - "prefix": "10.32.40.0/25" - }, - { - "subnetId": "/subscriptions/4efe155c-a0d1-4807-8c32-813b7894c342/resourceGroups/AlkiraEMEA_Demo/providers/Microsoft.Network/virtualNetworks/AlkiraEMEA_EU-North1-1-vnet/subnets/second", - "prefix": "10.32.41.128/25" - } - ] - }, - "serviceTags": [] - }, - "groupType": "APP", - "instances": [], - "state": "PENDING", - "size": "LARGE", - "segmentOptions": {}, - "asn": 64521, - "docState": "ADDED", - "deletedAt": -1, - "configAvailable": false, - "billingTags": [ - 343 - ], - "segmentIds": [ - 1636 - ], - "lastConfigUpdatedAt": 1655234759866, - "anyCPLId": 8839, - "enabled": true, - "primary": true, - "secondaryCXPs": [], - "userGroups": [] - } -] -# Services -[ - { - "id": 1505, - "name": "PAN1", - "internalName": "svc-pan-5402ecc7-f831-4323-9a86-2436ddad", - "cxp": "US-EAST-2", - "cxpId": "4e6c5c71-4e02-4f81-90c6-effbf8d50b7f", - "segments": [ - "Corporate", - "Pre Prod", - "Prod" - ], - "segmentIds": [ - 1636, - 1637, - 1638 - ], - "tenantId": 70, - "tenantNetworkId": 53, - "metadata": {}, - "state": "PENDING", - "size": "LARGE", - "type": "PAN", - "productId": "464bd9b5-64a2-491d-99ca-9210e6abce5e", - "otherAttributes": { - "panoramaEnabled": false, - "managementSegment": 1636, - "maxInstanceCount": 1, - "minInstanceCount": 1, - "licenseType": "PAY_AS_YOU_GO", - "version": "9.1.3", - "type": "VM-300", - "credentialId": "c47a70e1-eceb-43ec-91ee-05eff490f385", - "tunnelProtocol": "IPSEC", - "bundle": "PAN_VM_300_BUNDLE_2", - "globalProtectEnabled": false, - "masterKeyEnabled": false - }, - "instances": [ - { - "id": 1859, - "name": "PAN1-instance-1", - "internalName": "svci-pan-6c1a4893-416a-4fe7-a233-102d1976", - "tenantId": 70, - "tenantNetworkId": 53, - "productId": "464bd9b5-64a2-491d-99ca-9210e6abce5e", - "otherAttributes": { - "uniqueId": "8954e4bf-9ac9-4368-92b7-5d21875cf84e", - "credentialId": "2b84c358-ecdb-48f0-a039-0390a5af114b", - "hostName": "PAN1-instance-1", - "masterKeyEnabled": false - }, - "cxp": "US-EAST-2", - "docState": "ADDED", - "state": "PENDING", - "deletedAt": -1, - "configAvailable": true, - "billingTags": [ - 333 - ], - "dormant": false, - "lastConfigUpdatedAt": 1655234862596, - "networkEntityType": "SERVICE_INSTANCE" - } - ], - "licenseType": "PAY_AS_YOU_GO", - "docState": "ADDED", - "deletedAt": -1, - "configAvailable": true, - "panWarmBootEnabled": false, - "billingTags": [ - 333 - ], - "lastConfigUpdatedAt": 1655234862596 - } -] -# Global CIDR -[] diff --git a/config/awsvpcconnectors1.txt b/config/awsvpcconnectors1.txt new file mode 100644 index 0000000..b502b86 --- /dev/null +++ b/config/awsvpcconnectors1.txt @@ -0,0 +1,16 @@ +{ + "customerName": "AlkiraEMEA_US-East2-1-vpc", + "customerRegion": "us-east-2", + "name": "AlkiraEMEA_US-East2-1-vpc", + "vpcId": "vpc-052769d7efd0e75eb", + "credentialId": "b269e6d7-2b7d-45dc-9fb5-5ac1f49db139", + "group": "Users", + "cxp": "US-EAST-2", + "size": "MEDIUM", + "billingTags": [ + "333" + ], + "segments": [ + "Corporate" + ] +} diff --git a/config/awsvpcconnectors2.txt b/config/awsvpcconnectors2.txt new file mode 100644 index 0000000..348228e --- /dev/null +++ b/config/awsvpcconnectors2.txt @@ -0,0 +1,16 @@ +{ + "customerName": "AlkiraEMEA_US-East2-2-vpc", + "customerRegion": "us-east-2", + "name": "AlkiraEMEA_US-East2-2-vpc", + "vpcId": "vpc-007815b7e755ac4b3", + "credentialId": "b269e6d7-2b7d-45dc-9fb5-5ac1f49db139", + "group": "Users", + "cxp": "US-EAST-2", + "size": "MEDIUM", + "billingTags": [ + "333" + ], + "segments": [ + "Corporate" + ] +} diff --git a/config/azurevnetconnectors1.txt b/config/azurevnetconnectors1.txt new file mode 100644 index 0000000..2603d34 --- /dev/null +++ b/config/azurevnetconnectors1.txt @@ -0,0 +1,18 @@ +{ + "name": "AlkiraEMEA_EU-West1-1-vnet-AlkiraEMEA_Demo-4efe155c-a0d1-4807-8c32-813b7894c342", + "cxp": "GERMANYWESTCENTRAL-AZURE-1", + "cxpId": "b8e897c8-81ce-46a5-b474-7c243de97d0b", + "type": "AZURE_VNET", + "productId": "b7cf1adb-1cd1-4526-bc06-39136868f710", + "group": "Users", + "segments": [ + "Corporate" + ], + "vnetId": "/subscriptions/4efe155c-a0d1-4807-8c32-813b7894c342/resourceGroups/AlkiraEMEA_Demo/providers/Microsoft.Network/virtualNetworks/AlkiraEMEA_EU-West1-1-vnet", + "customerRegion": "westeurope", + "credentialId": "91f5e4cb-0fec-41a3-bf91-cf06ef3943bd", + "size": "LARGE", + "billingTags": [ + "333" + ] +} diff --git a/config/azurevnetconnectors2.txt b/config/azurevnetconnectors2.txt new file mode 100644 index 0000000..e9fbcdc --- /dev/null +++ b/config/azurevnetconnectors2.txt @@ -0,0 +1,18 @@ +{ + "name": "AlkiraEMEA_EU-West1-2-vnet-AlkiraEMEA_Demo-4efe155c-a0d1-4807-8c32-813b7894c342", + "cxp": "GERMANYWESTCENTRAL-AZURE-1", + "cxpId": "b8e897c8-81ce-46a5-b474-7c243de97d0b", + "type": "AZURE_VNET", + "productId": "b7cf1adb-1cd1-4526-bc06-39136868f710", + "group": "Users", + "segments": [ + "Corporate" + ], + "vnetId": "/subscriptions/4efe155c-a0d1-4807-8c32-813b7894c342/resourceGroups/AlkiraEMEA_Demo/providers/Microsoft.Network/virtualNetworks/AlkiraEMEA_EU-West1-2-vnet", + "customerRegion": "westeurope", + "credentialId": "91f5e4cb-0fec-41a3-bf91-cf06ef3943bd", + "size": "LARGE", + "billingTags": [ + "333" + ] +} diff --git a/config/azurevnetconnectors3.txt b/config/azurevnetconnectors3.txt new file mode 100644 index 0000000..991b62d --- /dev/null +++ b/config/azurevnetconnectors3.txt @@ -0,0 +1,18 @@ +{ + "name": "AlkiraEMEA_EU-North1-2-vnet-AlkiraEMEA_Demo-4efe155c-a0d1-4807-8c32-813b7894c342", + "cxp": "US-EAST-2", + "cxpId": "5ada678d-ce4a-428a-ac8d-0dc636b72b10", + "type": "AZURE_VNET", + "productId": "7a52bf02-48cc-4fa6-a80c-fa1e3b786e7e", + "group": "Users", + "segments": [ + "Corporate" + ], + "vnetId": "/subscriptions/4efe155c-a0d1-4807-8c32-813b7894c342/resourceGroups/AlkiraEMEA_Demo/providers/Microsoft.Network/virtualNetworks/AlkiraEMEA_EU-North1-2-vnet", + "customerRegion": "northeurope", + "credentialId": "91f5e4cb-0fec-41a3-bf91-cf06ef3943bd", + "size": "MEDIUM", + "billingTags": [ + "333" + ] +} diff --git a/config/azurevnetconnectors4.txt b/config/azurevnetconnectors4.txt new file mode 100644 index 0000000..d5faedd --- /dev/null +++ b/config/azurevnetconnectors4.txt @@ -0,0 +1,18 @@ +{ + "name": "AlkiraEMEA_EU-North1-1-vnet-AlkiraEMEA_Demo-4efe155c-a0d1-4807-8c32-813b7894c342", + "cxp": "US-EAST-2", + "cxpId": "5ada678d-ce4a-428a-ac8d-0dc636b72b10", + "type": "AZURE_VNET", + "productId": "7a52bf02-48cc-4fa6-a80c-fa1e3b786e7e", + "group": "Users", + "segments": [ + "Corporate" + ], + "vnetId": "/subscriptions/4efe155c-a0d1-4807-8c32-813b7894c342/resourceGroups/AlkiraEMEA_Demo/providers/Microsoft.Network/virtualNetworks/AlkiraEMEA_EU-North1-1-vnet", + "customerRegion": "northeurope", + "credentialId": "91f5e4cb-0fec-41a3-bf91-cf06ef3943bd", + "size": "MEDIUM", + "billingTags": [ + "333" + ] +} diff --git a/config/connectors.cnf b/config/connectors.cnf new file mode 100644 index 0000000..c2081e0 --- /dev/null +++ b/config/connectors.cnf @@ -0,0 +1,41 @@ +[ipsecconnectors1] +cxp = US-EAST-2 +segments = Corporate +group = Development +billingtags = 333 + +[awsvpcconnectors1] +cxp = GERMANYWESTCENTRAL-AZURE-1 +segments = Prod +group = Development +billingtags = 333 + +[awsvpcconnectors2] +cxp = GERMANYWESTCENTRAL-AZURE-1 +segments = Corporate +group = Development +billingtags = 333 + +[azurevnetconnectors1] +cxp = GERMANYWESTCENTRAL-AZURE-1 +segments = Prod +group = Development +billingtags = 333 + +[azurevnetconnectors2] +cxp = GERMANYWESTCENTRAL-AZURE-1 +segments = Corporate +group = Development +billingtags = 333 + +[azurevnetconnectors3] +cxp = GERMANYWESTCENTRAL-AZURE-1 +segments = Prod +group = Development +billingtags = 333 + +[azurevnetconnectors4] +cxp = GERMANYWESTCENTRAL-AZURE-1 +segments = Prod +group = Development +billingtags = 333 diff --git a/config/ipsecconnectors1.txt b/config/ipsecconnectors1.txt new file mode 100644 index 0000000..17bc5f0 --- /dev/null +++ b/config/ipsecconnectors1.txt @@ -0,0 +1,28 @@ +{ + "name": "Amsterdam", + "cxp": "US-EAST-2", + "cxpId": "5ada678d-ce4a-428a-ac8d-0dc636b72b10", + "type": "IP_SEC", + "group": "Users", + "segments": [ + "Corporate" + ], + "vpnMode": "ROUTE_BASED", + "routingOptions": { + "dynamicRouting": { + "customerGwAsn": "60131" + } + }, + "groupType": "USER", + "sites": [ + { + "name": "PAN", + "gatewayIpType": "STATIC", + "customerGwIp": "101.1.1.1" + } + ], + "billingTags": [ + "333" + ], + "size": "LARGE" +} diff --git a/get.py b/get.py index 1f0708f..7052baa 100755 --- a/get.py +++ b/get.py @@ -11,16 +11,16 @@ import configparser ############################################### -CONFIG_FILE = "/Users/mischa/Alkira/xDev/alkira.cnf" -if not os.path.isfile(CONFIG_FILE): - logging.error(f"The config file {CONFIG_FILE} doesn't exist") +ALKIRA_CONFIG= "/Users/mischa/Alkira/xDev/alkira.cnf" +if not os.path.isfile(ALKIRA_CONFIG): + logging.error(f"The config file {ALKIRA_CONFIG} doesn't exist") sys.exit(1) -config = configparser.RawConfigParser() -config.read(CONFIG_FILE) +alkira = configparser.RawConfigParser() +alkira.read(ALKIRA_CONFIG) -ALKIRA_TENANT = config.get('alkira', 'ALKIRA_TENANT') -ALKIRA_USERNAME = config.get('alkira', 'ALKIRA_USERNAME') -ALKIRA_PASSWORD = config.get('alkira', 'ALKIRA_PASSWORD') +ALKIRA_TENANT = alkira.get('alkira', 'ALKIRA_TENANT') +ALKIRA_USERNAME = alkira.get('alkira', 'ALKIRA_USERNAME') +ALKIRA_PASSWORD = alkira.get('alkira', 'ALKIRA_PASSWORD') ALKIRA_BASE_URI = f'https://{ALKIRA_TENANT}/api' ############################################### @@ -95,19 +95,17 @@ r = alkira_get(s, f'/tenantnetworks/{tenantNetworkId}/connectors') data = r.json() print('# Connectors') print(json.dumps(data, indent=4)) -#print(data) # Get services logging.info('Checking services') r = alkira_get(s, f'/tenantnetworks/{tenantNetworkId}/services') data = r.json() print('# Services') -#print(json.dumps(data, indent=4)) +print(json.dumps(data, indent=4)) # Get Global CIDR logging.info('Checking Global CIDR') r = alkira_get(s, f'/tenantnetworks/{tenantNetworkId}/global-cidr-lists') data = r.json() print('# Global CIDR') -#print(json.dumps(data, indent=4)) - +print(json.dumps(data, indent=4)) diff --git a/push-debug.py b/push-debug.py index 926902d..7b5bf75 100755 --- a/push-debug.py +++ b/push-debug.py @@ -11,16 +11,16 @@ import configparser ############################################### -CONFIG_FILE = "/Users/mischa/Alkira/xDev/alkira.cnf" -if not os.path.isfile(CONFIG_FILE): - logging.error(f"The config file {CONFIG_FILE} doesn't exist") +ALKIRA_CONFIG= "/Users/mischa/Alkira/xDev/alkira.cnf" +if not os.path.isfile(ALKIRA_CONFIG): + logging.error(f"The config file {ALKIRA_CONFIG} doesn't exist") sys.exit(1) -config = configparser.RawConfigParser() -config.read(CONFIG_FILE) +alkira = configparser.RawConfigParser() +alkira.read(CONFIG_FILE) -ALKIRA_TENANT = config.get('alkira', 'ALKIRA_TENANT') -ALKIRA_USERNAME = config.get('alkira', 'ALKIRA_USERNAME') -ALKIRA_PASSWORD = config.get('alkira', 'ALKIRA_PASSWORD') +ALKIRA_TENANT = alkira.get('alkira', 'ALKIRA_TENANT') +ALKIRA_USERNAME = alkira.get('alkira', 'ALKIRA_USERNAME') +ALKIRA_PASSWORD = alkira.get('alkira', 'ALKIRA_PASSWORD') ALKIRA_BASE_URI = f'https://{ALKIRA_TENANT}/api' ############################################### @@ -45,11 +45,11 @@ logging.info(f'Tenant Name: {tenantName}') logging.info(f'Tenant ID: {tenantNetworkId}') # Do Things -with open ('dump.txt', 'r') as f: +with open ('ipsecconnectors1.txt', 'r') as f: body = json.load(f) +print(json.dumps(body, indent=4)) print(json.dumps(body)) - -url = f'{ALKIRA_BASE_URI}/tenantnetworks/{tenantNetworkId}/awsvpcconnectors' +url = f'{ALKIRA_BASE_URI}/tenantnetworks/{tenantNetworkId}/ipsecconnectors' response = session.post(url, data=json.dumps(body), headers=headers) print(response.status_code) print(response.content) diff --git a/push.py b/push.py index 4d541a7..5b5395d 100755 --- a/push.py +++ b/push.py @@ -8,30 +8,62 @@ import time import logging import requests import configparser +import argparse + +# Parse all arguments +parser = argparse.ArgumentParser(description="Push JSON connfig to AlkirAPI") +parser.add_argument("-t", "--tenant", type=str, default='alkira.cnf', help="location of alikira.cnf (default: alkira.cnf") +parser.add_argument("-f", "--folder", type=str, default='config', help="location of the JSON connectors (default: config") +parser.add_argument("-c", "--config", type=str, default='connectors.cnf', help="location of the connectors config (default: config/connectors.cnf") +parser.add_argument("-v", "--verbose", type=int, default=0, help="Verbose level 0 or 1 (default: 0") + +try: + args = parser.parse_args() + ALKIRA_CONFIG = args.tenant + connector_folder = args.folder + CONNECTOR_CONFIG = f'{args.folder}/{args.config}' + +except argparse.ArgumentError as e: + print(str(e)) + sys.exit() + +try: + loglevel = { + 0: logging.INFO, + 1: logging.DEBUG + }[args.verbose] +except KeyError: + loglevel = logging.INFO ############################################### -CONFIG_FILE = "/Users/mischa/Alkira/xDev/alkira.cnf" -if not os.path.isfile(CONFIG_FILE): - logging.error(f"The config file {CONFIG_FILE} doesn't exist") - sys.exit(1) -config = configparser.RawConfigParser() -config.read(CONFIG_FILE) - -ALKIRA_TENANT = config.get('alkira', 'ALKIRA_TENANT') -ALKIRA_USERNAME = config.get('alkira', 'ALKIRA_USERNAME') -ALKIRA_PASSWORD = config.get('alkira', 'ALKIRA_PASSWORD') +# Tenant config +if not os.path.isfile(ALKIRA_CONFIG): + logging.error(f"The config file {ALKIRA_CONFIG} doesn't exist") + sys.exit(1) +alkira = configparser.RawConfigParser() +alkira.read(ALKIRA_CONFIG) +ALKIRA_TENANT = alkira.get('alkira', 'ALKIRA_TENANT') +ALKIRA_USERNAME = alkira.get('alkira', 'ALKIRA_USERNAME') +ALKIRA_PASSWORD = alkira.get('alkira', 'ALKIRA_PASSWORD') ALKIRA_BASE_URI = f'https://{ALKIRA_TENANT}/api' +# Connector config +if not os.path.isfile(CONNECTOR_CONFIG): + logging.error(f"The config file {CONNECTOR_CONFIG} doesn't exist") + sys.exit(1) +config = configparser.ConfigParser() +config.read(CONNECTOR_CONFIG) + +# Set loglevel (logging.INFO, logging.DEBUG) +logging.basicConfig(level=loglevel) +logging = logging.getLogger('AlkiraAPI') + ############################################### # Set default headers headers = {'Content-Type': "application/json"} -# Set logging.INFO to logging.DEBUG for debug information -logging.basicConfig(level=logging.INFO) -logging = logging.getLogger('AlkiraAPI') - # Naming exceptions service_exceptions = { "saas": "internet", @@ -63,8 +95,8 @@ def alkira_get(session, uri): response = session.get(url, headers=headers) response.raise_for_status() except Exception as e: - logging.error(f'Error: {str(e)}') - sys.exit(1) + logging.error(f'Error: {str(e)}') + sys.exit(1) return response def alkira_delete(session, uri): @@ -73,8 +105,8 @@ def alkira_delete(session, uri): response = session.delete(url, headers=headers) response.raise_for_status() except Exception as e: - logging.error(f'Error: {str(e)}') - sys.exit(1) + logging.error(f'Error: {str(e)}') + sys.exit(1) return response # Authenticate @@ -92,28 +124,35 @@ logging.info(f'Tenant ID: {tenantNetworkId}') # Push connectors logging.info('Push Connectors') -with open ('dump.txt', 'r') as f: - body = json.load(f) -print(json.dumps(body)) +for connector in config.sections(): + section = config[connector] + region = section['cxp'] + segments = section['segments'] + logging.debug(f'{section} - {region} - {segments}') + if 'group' in config: + group = section['group'] + logging.debug(group) + if 'billingtags' in config: + billingtags = section['billingtags'] + logging.debug(billingtags) -r = alkira_post(s, f'/tenantnetworks/{tenantNetworkId}/awsvpcconnectors', body) -data = r.json() -print(r.status_code) + connector_result = re.match(r'(\w+)(\d+)', connector) + connector_name = connector_result.group(1) + connector_number = connector_result.group(2) + logging.debug(f'{connector_folder}/{connector_name}{connector_number}.txt') + config_path = (f'{connector_folder}/{connector_name}{connector_number}.txt') + with open (config_path, 'r') as f: + body = json.load(f) + body['cxp'] = region + body['segments'][0] = segments + if 'group' in body and 'group' in globals(): + body['group'] = group -#print('# Connectors') -#print(json.dumps(data, indent=4)) - -## Get services -#logging.info('Checking services') -#r = alkira_get(s, f'/tenantnetworks/{tenantNetworkId}/services') -#data = r.json() -#print('# Services') -#print(json.dumps(data, indent=4)) -# -## Get Global CIDR -#logging.info('Checking Global CIDR') -#r = alkira_get(s, f'/tenantnetworks/{tenantNetworkId}/global-cidr-lists') -#data = r.json() -#print('# Global CIDR') -#print(json.dumps(data, indent=4)) + if 'billingTags' in body and 'billingtags' in globals(): + body['billingTags'][0] = billingtags + logging.debug(json.dumps(body)) + logging.info(f'Pushing {connector_name} to {region} (network segment: {segments})') + r = alkira_post(s, f'/tenantnetworks/{tenantNetworkId}/{connector_name}', body) + logging.info(r.status_code) + logging.debug(r.content) diff --git a/validate-json.py b/validate-json.py index a701825..7870c2b 100755 --- a/validate-json.py +++ b/validate-json.py @@ -2,6 +2,6 @@ import json -with open ('dump.txt', 'r') as f: +with open ('ipsecconnectors1.txt', 'r') as f: body = json.load(f) -print(body) + print(body)