|
|
@ -15,6 +15,7 @@ |
|
|
|
# V1.4.1 fixed check for existing images |
|
|
|
# V1.5 fixed detection of missing loop files for Ubuntu 16.04 in VIRL >=1.3, added default subtype creation |
|
|
|
# V1.51 fixed default subtype creation to use ssh management and max 22 ports, changed ram to 2GB as recommended by Arista |
|
|
|
# V1.52 fixed default subtype creation to support VIRL version <1.3 |
|
|
|
|
|
|
|
# usage |
|
|
|
if [ ! $# -eq 3 ] ; then |
|
|
@ -318,7 +319,7 @@ else |
|
|
|
fi |
|
|
|
|
|
|
|
# create deault subtype |
|
|
|
cat << EOF > dynamic-subtype-$GLANCE_IMAGE_NAME.json.default |
|
|
|
cat << EOF > dynamic-subtype-$GLANCE_IMAGE_NAME.json.default.virl-above-1.3 |
|
|
|
{ |
|
|
|
"dynamic-subtypes": [ |
|
|
|
{ |
|
|
@ -345,16 +346,52 @@ cat << EOF > dynamic-subtype-$GLANCE_IMAGE_NAME.json.default |
|
|
|
] |
|
|
|
} |
|
|
|
EOF |
|
|
|
CHECKING_FOR_EXISTING_SUBTYPE=$(virl_uwm_client subtype-info 2>&1 | grep $GLANCE_IMAGE_NAME) |
|
|
|
if [ $? == 1 ]; then |
|
|
|
cat << EOF > dynamic-subtype-$GLANCE_IMAGE_NAME.json.default.virl-below-1.3 |
|
|
|
{ |
|
|
|
"dynamic-subtypes": [ |
|
|
|
{ |
|
|
|
"plugin_base": "generic", |
|
|
|
"plugin_desc": "Arista vEOS", |
|
|
|
"cli_protocol": "ssh", |
|
|
|
"plugin_name": "$GLANCE_IMAGE_NAME", |
|
|
|
"cli_serial": 1, |
|
|
|
"interface_range": 22, |
|
|
|
"gui_visible": true, |
|
|
|
"interface_pattern": "Ethernet{0}", |
|
|
|
"baseline_image": "$GLANCE_IMAGE_NAME", |
|
|
|
"config_disk_type": "disk", |
|
|
|
"hw_ram": 2048, |
|
|
|
"hw_vm_extra": "", |
|
|
|
"gui_icon": "iosvl2", |
|
|
|
"config_file": "/veos_config.txt", |
|
|
|
"interface_first": 1, |
|
|
|
"deprecated_use": "", |
|
|
|
"baseline_flavor": "$GLANCE_IMAGE_NAME.medium", |
|
|
|
"interface_management": "Management1" |
|
|
|
} |
|
|
|
] |
|
|
|
} |
|
|
|
EOF |
|
|
|
CHECKING_FOR_EXISTING_SUBTYPE=$(virl_uwm_client subtype-info --name $GLANCE_IMAGE_NAME 2>&1) |
|
|
|
if [ $? == 255 ]; then |
|
|
|
echo "Creating default subtype $GLANCE_IMAGE_NAME..." |
|
|
|
echo "===========================================================" |
|
|
|
|
|
|
|
virl_uwm_client subtype-import --dynamic-subtypes @dynamic-subtype-$GLANCE_IMAGE_NAME.json.default |
|
|
|
CHECKING_FOR_EXISTING_DEVICE_TYPE=$(virl_uwm_client subtype-info 2>&1 | grep u\'device_type\':) |
|
|
|
if [ $? == 1 ]; then |
|
|
|
# device_type attribute is not available in VIRL < 1.3, use JSON definition of subtype without this attribute |
|
|
|
echo "detected VIRL version < 1.3, selecting appropriate subtype to import" |
|
|
|
virl_uwm_client subtype-import --dynamic-subtypes @dynamic-subtype-$GLANCE_IMAGE_NAME.json.default.virl-below-1.3 |
|
|
|
else |
|
|
|
echo "detected VIRL version > 1.3.0, selecting appropriate subtype to import" |
|
|
|
# device_type attribute is available, use JSON definition of subtype including this attribute |
|
|
|
virl_uwm_client subtype-import --dynamic-subtypes @dynamic-subtype-$GLANCE_IMAGE_NAME.json.default.virl-above-1.3 |
|
|
|
fi |
|
|
|
else |
|
|
|
echo "Default subtype $GLANCE_IMAGE_NAME already exists..." |
|
|
|
fi |
|
|
|
rm dynamic-subtype-$GLANCE_IMAGE_NAME.json.default |
|
|
|
rm dynamic-subtype-$GLANCE_IMAGE_NAME.json.default.virl-above-1.3 |
|
|
|
rm dynamic-subtype-$GLANCE_IMAGE_NAME.json.default.virl-below-1.3 |
|
|
|
|
|
|
|
echo |
|
|
|
echo "Image creation successful." |
|
|
|