Script to load vLB into AAI
The below put_vLB.sh script can be used to submit the vLB data to A&AI in order to run ConfigScaleOut use case. This script and referenced JSON files are used on an AAI instance where the cloud-region and tenant are already defined.
The syntax for executing the put_vLB.sh command is:
$ ./put_vLB.sh aai-ip-hostname
put_closed_loop.sh
#!/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.json
{
"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.json
image.json
vserver1.json
vserver2.json
relate_flavor.json
relate_image.json
generic-vnf.json
relate_vserver1.json
relate_vserver2.json
{
"related-to": "flavor",
"related-link": "/aai/v13/cloud-infrastructure/cloud-regions/cloud-region/pod25/RegionOne/flavors/flavor/764efb04-5a46-4806-a766-2bdd24559f39"
}