When testing VNF actions in A&AI it might be necessary to load the VNF data in A&AI required to test the VNF. One method is to use the below put_vLB.sh to submit the data to A&AI.
The syntax for executing the put_closed_loop.sh command is:
$ ./put_vLB.sh aai-ip-hostname
#!/bin/bash
set -x
HEADERS='-H "X-FromAppId: AAI-Temp-Tool" -H "X-TransactionId: AAI-Temp-Tool" -H "Real-Time: true" -H "Content-Type: application/json" -H "Accept: application/json"';
if [ $# -eq 0 ]; then
echo "Invalid you need to provide the ip address or hostname of machine to run the requests";
exit 1;
fi;
RESOURCE_HOSTNAME=$1;
#PORT=30232;
PORT=8443;
PROTOCOL=https;
eval curl -k -u appc@appc.onap.org:demo123456! -T flavor.json -X PUT $HEADERS $PROTOCOL://$RESOURCE_HOSTNAME:$PORT/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/pod25/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39
eval curl -k -u appc@appc.onap.org:demo123456! -T model.json -X PUT $HEADERS $PROTOCOL://$RESOURCE_HOSTNAME:$PORT/aai/v14/service-design-and-creation/models/model/APPC-vLB
eval curl -k -u appc@appc.onap.org:demo123456! -T image.json -X PUT $HEADERS $PROTOCOL://$RESOURCE_HOSTNAME:$PORT/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/pod25/RegionOne/images/image/6e219e86-cd94-4989-9119-def29aa10b12
eval curl -k -u appc@appc.onap.org:demo123456! -T vserver1.json -X PUT $HEADERS $PROTOCOL://$RESOURCE_HOSTNAME:$PORT/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/pod25/RegionOne/tenants/tenant/cf142fb96ce24770946c0f7117c0aeb3/vservers/vserver/06e8ea84-60b1-4e93-99da-73e589da9b69
eval curl -k -u appc@appc.onap.org:demo123456! -T vserver2.json -X PUT $HEADERS $PROTOCOL://$RESOURCE_HOSTNAME:$PORT/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/pod25/RegionOne/tenants/tenant/cf142fb96ce24770946c0f7117c0aeb3/vservers/vserver/7d2b1698-9b23-4a62-9aab-27629f15a2cc
eval curl -k -u appc@appc.onap.org:demo123456! -T relate_flavor.json -X PUT $HEADERS $PROTOCOL://$RESOURCE_HOSTNAME:$PORT/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/pod25/RegionOne/tenants/tenant/cf142fb96ce24770946c0f7117c0aeb3/vservers/vserver/7d2b1698-9b23-4a62-9aab-27629f15a2cc/relationship-list/relationship
eval curl -k -u appc@appc.onap.org:demo123456! -T relate_image.json -X PUT $HEADERS $PROTOCOL://$RESOURCE_HOSTNAME:$PORT/aai/v14/cloud-infrastructure/cloud-regions/cloud-region/pod25/RegionOne/tenants/tenant/cf142fb96ce24770946c0f7117c0aeb3/vservers/vserver/7d2b1698-9b23-4a62-9aab-27629f15a2cc/relationship-list/relationship
eval curl -k -u appc@appc.onap.org:demo123456! -T generic-vnf.json -X PUT $HEADERS $PROTOCOL://$RESOURCE_HOSTNAME:$PORT/aai/v14/network/generic-vnfs/generic-vnf/vLoadBalancer_demo_app
eval curl -k -u appc@appc.onap.org:demo123456! -T relate_vserver1.json -X PUT $HEADERS $PROTOCOL://$RESOURCE_HOSTNAME:$PORT/aai/v14/network/generic-vnfs/generic-vnf/vLoadBalancer_demo_app/relationship-list/relationship
eval curl -k -u appc@appc.onap.org:demo123456! -T relate_vserver2.json -X PUT $HEADERS $PROTOCOL://$RESOURCE_HOSTNAME:$PORT/aai/v14/network/generic-vnfs/generic-vnf/vLoadBalancer_demo_app/relationship-list/relationship
{
"model-invariant-id": "APPC-vLB",
"model-type": "sometype",
"model-vers": {
"model-ver": [
{
"model-version-id": "APPC-vLB-1",
"model-name": "vLB",
"model-version": "1"
}
]
}
}
{
"flavor-id": "764efb04-5a46-4806-a766-2bdd24559f39",
"flavor-name": "m1.medium",
"flavor-vcpus": 2,
"flavor-ram": 4096,
"flavor-disk": 40,
"flavor-ephemeral": 0,
"flavor-selflink": "http://10.12.25.2:8774/v2.1/cf142fb96ce24770946c0f7117c0aeb3/flavors/764efb04-5a46-4806-a766-2bdd24559f39"
}
{
"image-id": "6e219e86-cd94-4989-9119-def29aa10b12",
"image-name": "unknown",
"image-architecture": "unknown",
"image-os-distro": "unknown",
"image-os-version": "unknown",
"application": "unknown",
"application-vendor": "unknown",
"application-version": "unknown",
"image-selflink": "http://10.12.25.2:8774/cf142fb96ce24770946c0f7117c0aeb3/images/6e219e86-cd94-4989-9119-def29aa10b12"
}
{
"vserver-id": "06e8ea84-60b1-4e93-99da-73e589da9b69",
"vserver-name": "zdfw1lb01dns01",
"vserver-name2": "zdfw1lb01dns01",
"prov-status": "Running",
"vserver-selflink": "http://10.12.25.2:8774/v2.1/cf142fb96ce24770946c0f7117c0aeb3/servers/06e8ea84-60b1-4e93-99da-73e589da9b69",
"in-maint": false,
"is-closed-loop-disabled": false
}
{
"vserver-id": "7d2b1698-9b23-4a62-9aab-27629f15a2cc",
"vserver-name": "zdfw1lb01lb01",
"vserver-name2": "zdfw1lb01lb01",
"prov-status": "ACTIVE",
"vserver-selflink": "http://10.12.25.2:8774/v2.1/cf142fb96ce24770946c0f7117c0aeb3/servers/7d2b1698-9b23-4a62-9aab-27629f15a2cc",
"in-maint": false,
"is-closed-loop-disabled": false
}
{
"related-to": "flavor",
"related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/pod25/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39"
}
{
"related-to": "image",
"related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/pod25/RegionOne/images/image/6e219e86-cd94-4989-9119-def29aa10b12"
}
{
"vnf-id": "vLoadBalancer_demo_app",
"vnf-name": "vLoadBalancer-Vnf-APPC",
"vnf-type": "vLoadBalancer/vLoadBalancer-test 0",
"service-id": "f521546b-ca59-4a10-80b0-19967aa55eeb",
"prov-status": "PREPROV",
"orchestration-status": "Created",
"in-maint": false,
"is-closed-loop-disabled": false,
"model-invariant-id": "APPC-vLB",
"model-version-id": "APPC-vLB-1",
"model-customization-id": "84efad25-bb91-43bb-a465-552cee5665d0",
"nf-type": "",
"nf-function": "",
"nf-role": "",
"nf-naming-code": "",
"vf-modules": {
"vf-module": [
{
"vf-module-id": "zdfw1lb01lb01",
"vf-module-name": "zdfw1lb01lb01",
"heat-stack-id": "example-heat-stack-id-val-63769",
"orchestration-status": "example-orchestration-status-val-19362",
"is-base-vf-module": true,
"model-invariant-id": "APPC-vLB",
"model-version-id": "APPC-vLB-1",
"model-customization-id": "example-model-customization-id-val-86783",
"widget-model-id": "example-widget-model-id-val-60885",
"widget-model-version": "example-widget-model-version-val-35378",
"contrail-service-instance-fqdn": "example-contrail-service-instance-fqdn-val-94046",
"module-index": 2204,
"selflink": "example-selflink-val-44435"
}
]
}
}
{
"related-to": "vserver",
"related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/pod25/RegionOne/tenants/tenant/cf142fb96ce24770946c0f7117c0aeb3/vservers/vserver/06e8ea84-60b1-4e93-99da-73e589da9b69"
}
{
"related-to": "vserver",
"related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/pod25/RegionOne/tenants/tenant/cf142fb96ce24770946c0f7117c0aeb3/vservers/vserver/7d2b1698-9b23-4a62-9aab-27629f15a2cc"
}
{
"related-to": "flavor",
"related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/pod25/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39"
}