Browse Source

added support for combined vEOS-lab images, esp. vEOS-lab >= 4.21

master
Sebastian Rieger 5 years ago
parent
commit
6bd8e73304
  1. 390
      create-arista-veos-image/create-arista-veos-image.sh
  2. 24
      create-arista-veos-image/dynamic-subtype-vEOS-VIRL-Version-1.2.x.json
  3. 25
      create-arista-veos-image/dynamic-subtype-vEOS-VIRL-Version-above-1.3.x.json
  4. 2
      create-arista-veos-image/minimal-config-vEOS.txt

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

@ -16,6 +16,7 @@
# V1.5 fixed detection of missing loop files for Ubuntu 16.04 in VIRL >=1.3, added default subtype creation # 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.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 # V1.52 fixed default subtype creation to support VIRL version <1.3
# V2.0 added support for new partition layout of vEOS-lab >= 4.21 images, using an integrated bootloader (as the earlier combined versions)
# usage # usage
if [ ! $# -eq 3 ] ; then if [ ! $# -eq 3 ] ; then
@ -39,104 +40,79 @@ GLANCE_IMAGE_RELEASE=$VEOS_VMDK_BASENAME-$ABOOT_SERIAL_ISO_BASENAME
TMP_NAME="vEOS-$GLANCE_IMAGE_RELEASE" TMP_NAME="vEOS-$GLANCE_IMAGE_RELEASE"
TIMESTAMP=$(date +%Y%m%d%H%M%S) TIMESTAMP=$(date +%Y%m%d%H%M%S)
function wait_for_loop_dev_partitions() {
LOOPDEV_PARTITION_1=$1
LOOPDEV_PARTITION_2=$2
echo -n "waiting for loop devs from kpartx ($LOOPDEV_PARTITION_1 and $LOOPDEV_PARTITION_2)"
LOOP_DEV_RETRIES=0
until dd if=/dev/mapper/$LOOPDEV_PARTITION_1 of=/dev/null bs=1k count=1 &>/dev/null && dd if=/dev/mapper/$LOOPDEV_PARTITION_2 of=/dev/null bs=1k count=1 &>/dev/null ; do
echo -n "."
LOOP_DEV_RETRIES=$(expr $LOOP_DEV_RETRIES + 1)
if [ $LOOP_DEV_RETRIES -eq 10 ]; then
echo
echo "ERROR: timeout waiting for loop devs from kpartx"
exit -1
fi
sleep 1
done
return 0
}
function remove_loop_devs() {
LOOP_DEV_IMAGE=$1
LOOP_DEV_DEL_RETRIES=0
echo "removing loop devs from kpartx ($LOOP_DEV_IMAGE)"
until kpartx -vd $LOOP_DEV_IMAGE ; do
echo -n "."
LOOP_DEV_DEL_RETRIES=$(expr $LOOP_DEV_DEL_RETRIES + 1)
if [ $LOOP_DEV_DEL_RETRIES -eq 10 ]; then
echo
echo "ERROR: timeout waiting for loop dev removal from kpartx"
exit -1
fi
sleep 1
done
echo
return 0
}
function safe_unmount() { function safe_unmount() {
echo -n "Unmounting $1..."
MOUNTPOINT=$1
echo -n "Unmounting $MOUNTPOINT..."
RETRY=0 RETRY=0
until umount $1 &>/dev/null
until umount $MOUNTPOINT &>/dev/null
do do
echo -n "." echo -n "."
sleep 1 sleep 1
RETRY=$((RETRY+1)) RETRY=$((RETRY+1))
if [ "$RETRY" -ge "5" ] ; then if [ "$RETRY" -ge "5" ] ; then
echo echo
echo "ERROR: unable to unmount working directory $1"
exit 1
echo "ERROR: unable to unmount working directory $MOUNTPOINT"
exit -1
fi fi
done done
echo echo
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 --os-image-api-version 1 image-show $GLANCE_IMAGE_NAME 2>&1)
if [ $? == 0 ] ; then
glance --os-image-api-version 1 image-show $GLANCE_IMAGE_NAME
echo
function inject_rc_eos() {
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 "Injecting rc.eos startup script to get switch config..."
echo "===========================================================" echo "==========================================================="
glance --os-image-api-version 1 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 "Creating vEOS image..."
echo "==========================================================="
# inject rc.eos script to get switch config defined in VM Maestro (config-drive)
INJECTION_TIMESTAMP=$1
VEOS_VMDK_BASENAME_RC_EOS_PART=$2
# create a copy of Aboot bootloader and extend it to 3G
echo "Creating a copy of Aboot bootloader in $TMP_NAME.raw..."
cp $1 $TMP_NAME.raw
echo
echo "Extracting partitions from vEOS vmdk..."
echo "==========================================================="
# convert vmdk to raw and extract two partitions in it
echo "Converting vmdk image to raw..."
qemu-img convert -O raw $2 $VEOS_VMDK_BASENAME.raw
LOOPDEV=$(kpartx -av $VEOS_VMDK_BASENAME.raw)
LOOPDEV_PART1=$(echo "$LOOPDEV" | sed '1q;d' | cut -d " " -f 3)
LOOPDEV_PART2=$(echo "$LOOPDEV" | sed '2q;d' | cut -d " " -f 3)
echo "Output from kpartx: $LOOPDEV"
echo "PART1: $LOOPDEV_PART1"
echo "PART2: $LOOPDEV_PART2"
echo -n "waiting for loop devs from kpartx"
LOOP_DEV_RETRIES=0
until dd if=/dev/mapper/$LOOPDEV_PART1 of=/dev/null bs=1k count=1 &>/dev/null && dd if=/dev/mapper/$LOOPDEV_PART2 of=/dev/null bs=1k count=1 &>/dev/null ; do
echo -n "."
LOOP_DEV_RETRIES=$(expr $LOOP_DEV_RETRIES + 1)
if [ $LOOP_DEV_RETRIES -eq 10 ]; then
echo
echo "ERROR: timeout waiting for loop devs from kaprtx"
exit
fi
sleep 1
done
echo
echo "using dd to extract partitions..."
dd if=/dev/mapper/$LOOPDEV_PART1 of=$VEOS_VMDK_BASENAME-p1.raw
dd if=/dev/mapper/$LOOPDEV_PART2 of=$VEOS_VMDK_BASENAME-p2.raw
LOOP_DEV_DEL_RETRIES=0
echo "removing loop devs from kpartx"
until kpartx -vd $VEOS_VMDK_BASENAME.raw ; do
echo -n "."
LOOP_DEV_DEL_RETRIES=$(expr $LOOP_DEV_DEL_RETRIES + 1)
if [ $LOOP_DEV_DEL_RETRIES -eq 10 ]; then
echo
echo "ERROR: timeout waiting for loop dev removal from kaprtx"
exit
fi
sleep 1
done
echo
echo
echo "Injecting rc.eos startup script to get switch config..."
echo "==========================================================="
# inject rc.eos script in first partition of the image, to get switch config defined in VM Maestro (config-drive)
mkdir swi-$TIMESTAMP
echo "loop mounting image..."
mount -o loop $VEOS_VMDK_BASENAME-p1.raw swi-$TIMESTAMP
cd swi-$TIMESTAMP
echo "injecting rc.eos..."
cat << EOF > rc.eos
mkdir swi-$INJECTION_TIMESTAMP
echo "loop mounting image..."
mount -o loop $VEOS_VMDK_BASENAME_RC_EOS_PART swi-$INJECTION_TIMESTAMP
cd swi-$INJECTION_TIMESTAMP
echo "injecting rc.eos..."
cat << EOF > rc.eos
#!/bin/sh #!/bin/sh
# #
# startup script to get node configs from VM Maestro # startup script to get node configs from VM Maestro
@ -145,7 +121,16 @@ cat << EOF > rc.eos
echo "Getting switch config from config drive..." echo "Getting switch config from config drive..."
echo "==========================================" echo "=========================================="
mkdir /config-drive mkdir /config-drive
mount /dev/sdb1 /config-drive
# check if config drive is CDROM or DISK, CDROM is required for vEOS >=4.21 combined images
blkid | grep /dev/sr0 | grep CDROM
if [ \$? -eq 0 ]; then
# config_disk_type is cdrom
mount /dev/sr0 /config-drive
else
# config_disk_type is disk
mount /dev/sdb1 /config-drive
fi
echo "Getting ip address for ma1 via dhcp..." echo "Getting ip address for ma1 via dhcp..."
echo "==========================================" echo "=========================================="
@ -167,45 +152,110 @@ echo "Copying switch config from config drive..."
echo "==========================================" echo "=========================================="
cp /mnt/flash/startup-config.tmp /mnt/flash/startup-config cp /mnt/flash/startup-config.tmp /mnt/flash/startup-config
EOF EOF
chmod 755 rc.eos
cd ..
chmod 755 rc.eos
cd ..
echo "unmounting image..."
safe_unmount swi-$TIMESTAMP
echo "unmounting image..."
safe_unmount swi-$INJECTION_TIMESTAMP
rm -rf swi-$TIMESTAMP
rm -rf swi-$INJECTION_TIMESTAMP
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 --os-image-api-version 1 image-show $GLANCE_IMAGE_NAME 2>&1)
if [ $? == 0 ] ; then
glance --os-image-api-version 1 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 --os-image-api-version 1 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 "Injecting new partitions from vEOS vmdk in Aboot image..."
echo "Detecting partition layout..."
echo "===========================================================" echo "==========================================================="
echo "$VEOS_VMDK_BASENAME.raw (original vEOS vmdk layout):"
# convert vmdk to raw
echo "Converting vmdk image to raw..."
qemu-img convert -O raw $2 $VEOS_VMDK_BASENAME.raw
echo
echo "vEOS image partition layout:"
fdisk -l $VEOS_VMDK_BASENAME.raw fdisk -l $VEOS_VMDK_BASENAME.raw
echo "$TMP_NAME.raw (original ABoot bootloader layout):"
fdisk -l $TMP_NAME.raw
PARTITION_LAYOUT=$(fdisk -l $VEOS_VMDK_BASENAME.raw -l -o device,id | tail -2 | tr -s " " | cut -d " " -f 2)
PARTITION_TYPE_PART1=$(echo "$PARTITION_LAYOUT" | sed '1q;d')
PARTITION_TYPE_PART2=$(echo "$PARTITION_LAYOUT" | sed '2q;d')
# calulate size of the two partitions
PART1_START=$(fdisk -l $VEOS_VMDK_BASENAME.raw | grep "\.raw1" | tr -s " " | cut -d ' ' -f 3)
PART1_END=$(fdisk -l $VEOS_VMDK_BASENAME.raw | grep "\.raw1" | tr -s " " | cut -d ' ' -f 4)
PART1_LENGTH=$(expr $PART1_END - $PART1_START)
if [ "$PARTITION_TYPE_PART1" == "c" ] && [ "$PARTITION_TYPE_PART2" == "12" ]; then
PARTITION_LAYOUT_TYPE="old"
CONFIG_DISK_TYPE="disk"
echo
echo "Detected old partition layout. Bootloader partition needs to be injected in vEOS image..."
# create a copy of Aboot bootloader and extend it to vEOS image size
echo "Creating a copy of Aboot bootloader in $TMP_NAME.raw..."
cp $1 $TMP_NAME.raw
LOOPDEV=$(kpartx -av $VEOS_VMDK_BASENAME.raw)
LOOPDEV_PART1=$(echo "$LOOPDEV" | sed '1q;d' | cut -d " " -f 3)
LOOPDEV_PART2=$(echo "$LOOPDEV" | sed '2q;d' | cut -d " " -f 3)
echo "Output from kpartx: $LOOPDEV"
echo "PART1: $LOOPDEV_PART1"
echo "PART2: $LOOPDEV_PART2"
wait_for_loop_dev_partitions $LOOPDEV_PART1 $LOOPDEV_PART2
echo
echo "using dd to extract partitions..."
dd if=/dev/mapper/$LOOPDEV_PART1 of=$VEOS_VMDK_BASENAME-p1.raw
dd if=/dev/mapper/$LOOPDEV_PART2 of=$VEOS_VMDK_BASENAME-p2.raw
remove_loop_devs $VEOS_VMDK_BASENAME.raw
# inject rc.eos file to allow configuration from VM Maestro
inject_rc_eos $TIMESTAMP $VEOS_VMDK_BASENAME-p1.raw
echo
echo "Injecting new partitions from vEOS vmdk in Aboot image..."
echo "==========================================================="
echo "$VEOS_VMDK_BASENAME.raw (original vEOS vmdk layout):"
fdisk -l $VEOS_VMDK_BASENAME.raw
echo "$TMP_NAME.raw (original ABoot bootloader layout):"
fdisk -l $TMP_NAME.raw
# calulate size of the two partitions
PART1_START=$(fdisk -l $VEOS_VMDK_BASENAME.raw | grep "\.raw1" | tr -s " " | cut -d ' ' -f 3)
PART1_END=$(fdisk -l $VEOS_VMDK_BASENAME.raw | grep "\.raw1" | tr -s " " | cut -d ' ' -f 4)
PART1_LENGTH=$(expr $PART1_END - $PART1_START)
echo "raw1 start=$PART1_START,end=$PART1_END,length=$PART1_LENGTH"
echo "raw1 start=$PART1_START,end=$PART1_END,length=$PART1_LENGTH"
PART2_START=$(fdisk -l $VEOS_VMDK_BASENAME.raw | grep "\.raw2" | tr -s " " | cut -d ' ' -f 2)
PART2_END=$(fdisk -l $VEOS_VMDK_BASENAME.raw | grep "\.raw2" | tr -s " " | cut -d ' ' -f 3)
PART2_LENGTH=$(expr $PART2_END - $PART2_START)
PART2_START=$(fdisk -l $VEOS_VMDK_BASENAME.raw | grep "\.raw2" | tr -s " " | cut -d ' ' -f 2)
PART2_END=$(fdisk -l $VEOS_VMDK_BASENAME.raw | grep "\.raw2" | tr -s " " | cut -d ' ' -f 3)
PART2_LENGTH=$(expr $PART2_END - $PART2_START)
echo "raw2 start=$PART2_START,end=$PART2_END,length=$PART2_LENGTH"
echo "raw2 start=$PART2_START,end=$PART2_END,length=$PART2_LENGTH"
# extend the bootloader iso to be able to append the two partitions
EXTENSION_SIZE=$(ls -lk $VEOS_VMDK_BASENAME.raw | tr -s " " | cut -d " " -f 5)
echo "extending image $TMP_NAME.raw to +$EXTENSION_SIZE"
truncate -s +$EXTENSION_SIZE $TMP_NAME.raw
# extend the bootloader iso to be able to append the two partitions
EXTENSION_SIZE=$(ls -lk $VEOS_VMDK_BASENAME.raw | tr -s " " | cut -d " " -f 5)
echo "extending image $TMP_NAME.raw to +$EXTENSION_SIZE"
truncate -s +$EXTENSION_SIZE $TMP_NAME.raw
echo "appending partitions from vmdk in the bootloader iso in $TMP_NAME.raw..."
# append the two partitions from vmdk in the bootloader iso
echo -e "n
echo "appending partitions from vmdk in the bootloader iso in $TMP_NAME.raw..."
# append the two partitions from vmdk in the bootloader iso
echo -e "n
p p
@ -225,45 +275,90 @@ t
12 12
w" | fdisk $TMP_NAME.raw w" | fdisk $TMP_NAME.raw
echo "$TMP_NAME.raw (new combined image layout):"
fdisk -l $TMP_NAME.raw
# copy the partitions from vEOS vmdk to new image
LOOPDEV=$(kpartx -av $TMP_NAME.raw)
LOOPDEV_PART2=$(echo "$LOOPDEV" | sed '2q;d' | cut -d " " -f 3)
LOOPDEV_PART3=$(echo "$LOOPDEV" | sed '3q;d' | cut -d " " -f 3)
echo "Output from kpartx: $LOOPDEV"
echo "PART1: $LOOPDEV_PART1"
echo "PART2: $LOOPDEV_PART2"
echo -n "waiting for loop devs from kpartx"
LOOP_DEV_RETRIES=0
until dd if=/dev/mapper/$LOOPDEV_PART2 of=/dev/null bs=1k count=1 &>/dev/null && dd if=/dev/mapper/$LOOPDEV_PART3 of=/dev/null bs=1k count=1 &>/dev/null ; do
echo -n "."
LOOP_DEV_RETRIES=$(expr $LOOP_DEV_RETRIES + 1)
if [ $LOOP_DEV_RETRIES -eq 10 ]; then
echo "$TMP_NAME.raw (new combined image layout):"
fdisk -l $TMP_NAME.raw
# copy the partitions from vEOS vmdk to new image
LOOPDEV=$(kpartx -av $TMP_NAME.raw)
LOOPDEV_FIRST_PART=$(echo "$LOOPDEV" | sed '2q;d' | cut -d " " -f 3)
LOOPDEV_SECOND_PART=$(echo "$LOOPDEV" | sed '3q;d' | cut -d " " -f 3)
echo "Output from kpartx: $LOOPDEV"
echo "PART2: $LOOPDEV_FIRST_PART"
echo "PART3: $LOOPDEV_SECOND_PART"
wait_for_loop_dev_partitions $LOOPDEV_FIRST_PART $LOOPDEV_SECOND_PART
echo echo
echo "ERROR: timeout waiting for loop devs from kaprtx"
exit
fi
sleep 1
done
echo
echo "copying the partitions from vEOS vmdk to new image..."
dd if=$VEOS_VMDK_BASENAME-p1.raw of=/dev/mapper/$LOOPDEV_PART2
dd if=$VEOS_VMDK_BASENAME-p2.raw of=/dev/mapper/$LOOPDEV_PART3
LOOP_DEV_DEL_RETRIES=0
echo "removing loop devs from kpartx"
until kpartx -vd $TMP_NAME.raw ; do
echo -n "."
LOOP_DEV_DEL_RETRIES=$(expr $LOOP_DEV_DEL_RETRIES + 1)
if [ $LOOP_DEV_DEL_RETRIES -eq 10 ]; then
echo "copying the partitions from vEOS vmdk to new image..."
dd if=$VEOS_VMDK_BASENAME-p1.raw of=/dev/mapper/$LOOPDEV_FIRST_PART
dd if=$VEOS_VMDK_BASENAME-p2.raw of=/dev/mapper/$LOOPDEV_SECOND_PART
remove_loop_devs $TMP_NAME.raw
rm $VEOS_VMDK_BASENAME-p1.raw
rm $VEOS_VMDK_BASENAME-p2.raw
elif [ "$PARTITION_TYPE_PART1" == "17" ] && [ "$PARTITION_TYPE_PART2" == "83" ]; then
PARTITION_LAYOUT_TYPE="new"
CONFIG_DISK_TYPE="cdrom"
echo echo
echo "ERROR: timeout waiting for loop dev removal from kaprtx"
exit
fi
echo "Detected new combined partition layout. Bootloader already integrated in vEOS image ..."
# extract bootloader partition
LOOPDEV=$(kpartx -av $ABOOT_SERIAL_ISO)
LOOPDEV_FIRST_PART=$(echo "$LOOPDEV" | sed '1q;d' | cut -d " " -f 3)
echo "Output from kpartx: $LOOPDEV"
echo "PART1: $LOOPDEV_FIRST_PART"
# waiting for loop parts can be improved, using only one arg, better solution: get rid of kpartx completely and extract parts using dd etc.
wait_for_loop_dev_partitions $LOOPDEV_FIRST_PART $LOOPDEV_FIRST_PART
echo
echo "copying the bootloader partition..."
dd if=/dev/mapper/$LOOPDEV_FIRST_PART of=$ABOOT_SERIAL_ISO_BASENAME-p1.raw
remove_loop_devs $ABOOT_SERIAL_ISO
# create a copy of vEOS image
echo "Creating a copy of vEOS image in $TMP_NAME.raw..."
cp $VEOS_VMDK_BASENAME.raw $TMP_NAME.raw
# modify the content of the partitions of the image
LOOPDEV=$(kpartx -av $TMP_NAME.raw)
LOOPDEV_FIRST_PART=$(echo "$LOOPDEV" | sed '1q;d' | cut -d " " -f 3)
LOOPDEV_SECOND_PART=$(echo "$LOOPDEV" | sed '2q;d' | cut -d " " -f 3)
echo "Output from kpartx: $LOOPDEV"
echo "PART1: $LOOPDEV_FIRST_PART"
echo "PART2: $LOOPDEV_SECOND_PART"
wait_for_loop_dev_partitions $LOOPDEV_FIRST_PART $LOOPDEV_SECOND_PART
# inject rc.eos file to allow configuration from VM Maestro
inject_rc_eos $TIMESTAMP /dev/mapper/$LOOPDEV_SECOND_PART
# next lines currently commented out to use supplied bootloader in image
# boot process can maybe be improved as Aboot is looking for /mnt/flash.conf and fails in new images
#echo
#echo "Overwrite Aboot bootloader in vEOS image..."
#echo "==========================================================="
#dd if=$ABOOT_SERIAL_ISO_BASENAME-p1.raw of=/dev/mapper/$LOOPDEV_FIRST_PART
sleep 1 sleep 1
done
echo
remove_loop_devs $TMP_NAME.raw
rm $ABOOT_SERIAL_ISO_BASENAME-p1.raw
else
echo
echo "ERROR: Provided vEOS image uses unknown partition layout. Unable to extract and modify partitions."
exit -1
fi
echo echo
echo "Convert new image to qcow2..." echo "Convert new image to qcow2..."
@ -278,8 +373,6 @@ echo "==========================================================="
#cleanup #cleanup
rm $TMP_NAME.raw rm $TMP_NAME.raw
rm $VEOS_VMDK_BASENAME-p1.raw
rm $VEOS_VMDK_BASENAME-p2.raw
rm $VEOS_VMDK_BASENAME.raw rm $VEOS_VMDK_BASENAME.raw
echo echo
@ -287,7 +380,7 @@ echo "Importing image into glance..."
echo "===========================================================" echo "==========================================================="
glance image-create --container-format bare --disk-format qcow2 --visibility public --name $GLANCE_IMAGE_NAME \ glance image-create --container-format bare --disk-format qcow2 --visibility public --name $GLANCE_IMAGE_NAME \
--file $TMP_NAME.qcow2 --property hw_disk_bus=ide --property serial=1 \ --file $TMP_NAME.qcow2 --property hw_disk_bus=ide --property serial=1 \
--property hw_vif_model=e1000 --property hw_cdrom_type=ide --property release="$GLANCE_IMAGE_RELEASE" --property subtype=IOSv --property config_disk_type=disk
--property hw_vif_model=e1000 --property hw_cdrom_type=ide --property release="$GLANCE_IMAGE_RELEASE" --property subtype=$GLANCE_IMAGE_NAME --property config_disk_type=$CONFIG_DISK_TYPE
# create default flavor # create default flavor
CHECKING_FOR_EXISTING_FLAVOR=$(nova flavor-show $GLANCE_IMAGE_NAME.tiny 2>&1) CHECKING_FOR_EXISTING_FLAVOR=$(nova flavor-show $GLANCE_IMAGE_NAME.tiny 2>&1)
@ -333,7 +426,7 @@ cat << EOF > dynamic-subtype-$GLANCE_IMAGE_NAME.json.default.virl-above-1.3
"gui_visible": true, "gui_visible": true,
"interface_pattern": "Ethernet{0}", "interface_pattern": "Ethernet{0}",
"baseline_image": "$GLANCE_IMAGE_NAME", "baseline_image": "$GLANCE_IMAGE_NAME",
"config_disk_type": "disk",
"config_disk_type": "$CONFIG_DISK_TYPE",
"hw_ram": 2048, "hw_ram": 2048,
"hw_vm_extra": "", "hw_vm_extra": "",
"gui_icon": "iosvl2", "gui_icon": "iosvl2",
@ -359,7 +452,7 @@ cat << EOF > dynamic-subtype-$GLANCE_IMAGE_NAME.json.default.virl-below-1.3
"gui_visible": true, "gui_visible": true,
"interface_pattern": "Ethernet{0}", "interface_pattern": "Ethernet{0}",
"baseline_image": "$GLANCE_IMAGE_NAME", "baseline_image": "$GLANCE_IMAGE_NAME",
"config_disk_type": "disk",
"config_disk_type": "$CONFIG_DISK_TYPE",
"hw_ram": 2048, "hw_ram": 2048,
"hw_vm_extra": "", "hw_vm_extra": "",
"gui_icon": "iosvl2", "gui_icon": "iosvl2",
@ -380,7 +473,7 @@ if [ $? == 255 ]; then
CHECKING_FOR_EXISTING_DEVICE_TYPE=$(virl_uwm_client subtype-info 2>&1 | grep u\'device_type\':) CHECKING_FOR_EXISTING_DEVICE_TYPE=$(virl_uwm_client subtype-info 2>&1 | grep u\'device_type\':)
if [ $? == 1 ]; then if [ $? == 1 ]; then
# device_type attribute is not available in VIRL < 1.3, use JSON definition of subtype without this attribute # 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"
echo "detected VIRL version < 1.3.0, selecting appropriate subtype to import"
virl_uwm_client subtype-import --dynamic-subtypes @dynamic-subtype-$GLANCE_IMAGE_NAME.json.default.virl-below-1.3 virl_uwm_client subtype-import --dynamic-subtypes @dynamic-subtype-$GLANCE_IMAGE_NAME.json.default.virl-below-1.3
else else
echo "detected VIRL version > 1.3.0, selecting appropriate subtype to import" echo "detected VIRL version > 1.3.0, selecting appropriate subtype to import"
@ -404,3 +497,4 @@ echo "You can import and use the subtype $GLANCE_IMAGE_NAME in VM Maestro..."
# nova boot --image "Arista vEOS Disk" --flavor m1.small veos --nic net-id=abc7ad47-55fd-4396-8d31-91dd4d41a18a --nic net-id=abc7ad47-55fd-4396-8d31-91dd4d41a18a --nic net-id=abc7ad47-55fd-4396-8d31-91dd4d41a18a --nic net-id=abc7ad47-55fd-4396-8d31-91dd4d41a18a --nic net-id=abc7ad47-55fd-4396-8d31-91dd4d41a18a # nova boot --image "Arista vEOS Disk" --flavor m1.small veos --nic net-id=abc7ad47-55fd-4396-8d31-91dd4d41a18a --nic net-id=abc7ad47-55fd-4396-8d31-91dd4d41a18a --nic net-id=abc7ad47-55fd-4396-8d31-91dd4d41a18a --nic net-id=abc7ad47-55fd-4396-8d31-91dd4d41a18a --nic net-id=abc7ad47-55fd-4396-8d31-91dd4d41a18a
# #
# using VM Maestro, the image can be chosen as "VM image", e.g., for an IOSv or IOSvL2 node # using VM Maestro, the image can be chosen as "VM image", e.g., for an IOSv or IOSvL2 node

24
create-arista-veos-image/dynamic-subtype-vEOS-VIRL-Version-1.2.x.json

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

25
create-arista-veos-image/dynamic-subtype-vEOS-VIRL-Version-above-1.3.x.json

@ -1,25 +0,0 @@
{
"dynamic-subtypes": [
{
"plugin_base": "generic",
"device_type": "switch",
"plugin_desc": "Arista vEOS",
"cli_protocol": "ssh",
"plugin_name": "vEOS",
"cli_serial": 1,
"interface_range": 22,
"gui_visible": true,
"interface_pattern": "Ethernet{0}",
"baseline_image": "vEOS",
"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": "vEOS.medium",
"interface_management": "Management1"
}
]
}

2
create-arista-veos-image/minimal-config-vEOS.txt

@ -1,4 +1,4 @@
! device: veos-1 (vEOS, EOS-4.14.2F)
! device: veos-1 (vEOS)
! !
! boot system flash:/vEOS.swi ! boot system flash:/vEOS.swi
! !

Loading…
Cancel
Save