Browse Source

automatic import of subtype and creation of flavors based on image name,

short instructions on how to use the image and hint to default node
configuration, removed detection of existing image as new VIRL version
supports multiple versions, new subtype to allow >8 front panel
interfaces
master
Sebastian Rieger 9 years ago
parent
commit
65647bda1e
  1. 118
      create-arista-veos-image/create-arista-veos-image.sh
  2. 22
      create-arista-veos-image/dynamic-subtype-vEOS.json

118
create-arista-veos-image/create-arista-veos-image.sh

@ -12,6 +12,9 @@
# V1.31 added support for newer glance releases (e.g. kilo) used in VIRL 1.0.0 # V1.31 added support for newer glance releases (e.g. kilo) used in VIRL 1.0.0
# V1.32 changed the extension of the bootloader iso to match the size of the partitions to be injected # V1.32 changed the extension of the bootloader iso to match the size of the partitions to be injected
# V1.4 support for variable VEOS image sizes (as requested by @Jade_Deane to use custom VEOS images) # V1.4 support for variable VEOS image sizes (as requested by @Jade_Deane to use custom VEOS images)
# V1.5 automatic import of subtype and creation of flavors based on image name,
# short instructions on how to use the image and hint to default node configuration,
# removed detection of existing image as new VIRL version supports multiple versions
# usage # usage
if [ ! $# -eq 3 ] ; then if [ ! $# -eq 3 ] ; then
@ -53,24 +56,6 @@ function safe_unmount() {
return 0 return 0
} }
# check for an existing image with the same name and offer to delete it prior to creating a new one
CHECK_FOR_EXISTING_IMAGE=$(glance image-show $GLANCE_IMAGE_NAME 2>&1)
if [ $? == 0 ] ; then
glance image-show $GLANCE_IMAGE_NAME
echo
echo
read -r -p "There is already an image with the same name in glance. Do you want to overwrite it? [y/N] " RESPONSE
if [[ $RESPONSE =~ ^([yY][eE][sS]|[yY])$ ]] ; then
echo "Deleting existing image $GLANCE_IMAGE_NAME..."
echo "==========================================================="
glance image-delete $GLANCE_IMAGE_NAME
else
echo "An image with the same name already exists. Either delete this image or choose another name."
exit 1
fi
fi
echo echo
echo "Creating vEOS image..." echo "Creating vEOS image..."
echo "===========================================================" echo "==========================================================="
@ -215,14 +200,105 @@ if [ $? == 1 ]; then
nova flavor-create --is-public true vEOS.small auto 1024 0 1 nova flavor-create --is-public true vEOS.small auto 1024 0 1
fi fi
CHECKING_FOR_EXISTING_FLAVOR=$(nova flavor-show vEOS.medium 2>&1)
CHECKING_FOR_EXISTING_FLAVOR=$(nova flavor-show $GLANCE_IMAGE_NAME.medium 2>&1)
if [ $? == 1 ]; then if [ $? == 1 ]; then
echo "Creating default flavor vEOS.medium..."
echo "Creating default flavor $GLANCE_IMAGE_NAME.medium..."
echo "===========================================================" echo "==========================================================="
nova flavor-create --is-public true vEOS.medium auto 2048 0 1
nova flavor-create --is-public true $GLANCE_IMAGE_NAME.medium auto 2048 0 1
fi fi
CHECKING_FOR_EXISTING_FLAVOR=$(nova flavor-show $GLANCE_IMAGE_NAME.small 2>&1)
if [ $? == 1 ]; then
echo "Creating default flavor $GLANCE_IMAGE_NAME.small..."
echo "==========================================================="
nova flavor-create --is-public true $GLANCE_IMAGE_NAME.small auto 1024 0 1
fi
#CHECKING_FOR_EXISTING_SUBTYPE=$(virl_uwm_client subtype-export 2>/dev/null | grep -Po '"'"plugin_desc"'"\s*:\s*"\K([^"]*)')
CHECKING_FOR_EXISTING_SUBTYPE=$(virl_uwm_client subtype-export 2>/dev/null | grep "\"plugin_name\": \"$GLANCE_IMAGE_NAME\",")
if [ $? == 1 ]; then
# create default subtype
cat << EOF > $TIMESTAMP.default-subtype
{
"dynamic-subtypes": [
{
"interface_range": 22,
"config_disk_type": "disk",
"baseline_image": "$GLANCE_IMAGE_NAME",
"baseline_flavor": "$GLANCE_IMAGE_NAME.medium",
"hw_vm_extra": "",
"plugin_desc": "Arista vEOS",
"interface_pattern": "Ethernet{0}",
"interface_management": "Management1",
"gui_visible": true,
"cli_serial": 1,
"hw_ram": 1024,
"plugin_name": "$GLANCE_IMAGE_NAME",
"interface_first": 1,
"config_file": "/veos_config.txt",
"gui_icon": "iosvl2",
"plugin_base": "generic"
}
]
}
EOF
echo "Creating default subtype vEOS..."
echo "==========================================================="
virl_uwm_client subtype-import --dynamic-subtypes @$TIMESTAMP.default-subtype
rm $TIMESTAMP.default-subtype
fi
echo
echo "Creation of the image finished successfully"
echo "==========================================================="
echo "You can import the default Subtype in VM Maestro using"
echo "\"File->Preferences->Node Subtypes->Restore Defaults\""
echo "followed by clicking on \"Fetch from Server\". Afterwards,"
echo "vEOS should appear in the \"Nodes\" section of VM Maestro's"
echo "Topology Palette. The following default config can be used"
echo "by pasting it into the Configuration tab after clicking on"
echo "each vEOS node created in your topology:"
echo -e "
! device: veos-1 (vEOS, EOS-4.14.2F)
!
! boot system flash:/vEOS.swi
!
transceiver qsfp default-mode 4x10G
!
hostname veos-1
!
spanning-tree mode mstp
!
no aaa root
!
username admin role network-admin secret 5 \$1\$93LlZesx\$MSqS1D/8NGTSY724FGx1K0
username cisco role network-admin secret 5 \$1\$rQS0W9wP\$ZUzVG2XoGCCZCJopFp1aV/
!
interface Ethernet1
!
interface Ethernet2
!
interface Management1
! ip of ma1 configured on launch
!
no ip routing
!
!
"
echo "Of course you modify the config (name, version) to your needs."
echo "Otherwise, vEOS will will start with an empty configuration and"
echo "go into Zero-Touch-Provisioning (ZTP) mode. You should also disable"
echo "\"Auto-generate the configuration based on these attributes\" in"
echo "the AutoNetkit tab of the node, as AutoNetkit is only supported"
echo "for the Cisco images in VIRL."
#testing: #testing:
# #

22
create-arista-veos-image/dynamic-subtype-vEOS.json

@ -1,24 +1,22 @@
{ {
"dynamic-subtypes": [ "dynamic-subtypes": [
{ {
"plugin_name": "vEOS",
"cli_serial": 1,
"plugin_desc": "Arista vEOS",
"interface_range": 22,
"config_disk_type": "disk",
"baseline_image": "vEOS", "baseline_image": "vEOS",
"hw_ram": 1024,
"baseline_flavor": "vEOS.medium",
"hw_vm_extra": "", "hw_vm_extra": "",
"interface_wrap": 7,
"config_disk_type": "disk",
"plugin_desc": "Arista vEOS",
"interface_pattern": "Ethernet{0}", "interface_pattern": "Ethernet{0}",
"interface_management": "Management1",
"gui_visible": true, "gui_visible": true,
"config_file": "/veos_config.txt",
"cli_serial": 1,
"hw_ram": 1024,
"plugin_name": "vEOS",
"interface_first": 1, "interface_first": 1,
"config_file": "/veos_config.txt",
"gui_icon": "iosvl2", "gui_icon": "iosvl2",
"plugin_base": "generic",
"vnc_available": false,
"interface_management": "Management1",
"interface_range": 7,
"baseline_flavor": "vEOS.medium"
"plugin_base": "generic"
} }
] ]
} }
Loading…
Cancel
Save