Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
V
virl-utils-hs-fulda
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Sebastian Rieger
virl-utils-hs-fulda
Commits
4ca0613a
Commit
4ca0613a
authored
Jul 11, 2016
by
Sebastian Rieger
Browse files
Options
Downloads
Patches
Plain Diff
fixed check for exsiting images
parent
24b11676
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
create-arista-veos-image/create-arista-veos-image.sh
+31
-106
31 additions, 106 deletions
create-arista-veos-image/create-arista-veos-image.sh
create-f5-bigip-image/create-f5-big-ip-image.sh
+166
-166
166 additions, 166 deletions
create-f5-bigip-image/create-f5-big-ip-image.sh
with
197 additions
and
272 deletions
create-arista-veos-image/create-arista-veos-image.sh
+
31
−
106
View file @
4ca0613a
...
...
@@ -4,17 +4,15 @@
#
# changelog:
# V1.1 added injection of config defined in VM Maestro using config-drivex
# V1.11 fixed device mapping of extracted partitions, fixed problems with stale swi directory
# V1.12 rc.eos now supports e1000 and virtio as vnic types (virtio is supported in vEOS >=4.14.5F)
# V1.1
.
1 fixed device mapping of extracted partitions, fixed problems with stale swi directory
# V1.1
.
2 rc.eos now supports e1000 and virtio as vnic types (virtio is supported in vEOS >=4.14.5F)
# V1.2 added dynamic handling of device mapping of extacted partitions
# V1.21 checking whether it safe to unmount working directories
# V1.3 added support to delete existing image with the same name and generating the default nova flavor
# 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.3
.
1 added support for newer glance releases (e.g. kilo) used in VIRL 1.0.0
# V1.3
.
2 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.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
# V1.4.1 fixed check for existing images
# usage
if
[
!
$#
-eq
3
]
;
then
...
...
@@ -56,6 +54,24 @@ function safe_unmount() {
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
"Creating vEOS image..."
echo
"==========================================================="
...
...
@@ -200,105 +216,14 @@ if [ $? == 1 ]; then
nova flavor-create
--is-public
true
vEOS.small auto 1024 0 1
fi
CHECKING_FOR_EXISTING_FLAVOR
=
$(
nova flavor-show
$GLANCE_IMAGE_NAME
.medium 2>&1
)
if
[
$?
==
1
]
;
then
echo
"Creating default flavor
$GLANCE_IMAGE_NAME
.medium..."
echo
"==========================================================="
nova flavor-create
--is-public
true
$GLANCE_IMAGE_NAME
.medium auto 2048 0 1
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
\"
,"
)
CHECKING_FOR_EXISTING_FLAVOR
=
$(
nova flavor-show vEOS.medium 2>&1
)
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
"Creating default flavor vEOS.medium..."
echo
"==========================================================="
virl_uwm_client subtype-import
--dynamic-subtypes
@
$TIMESTAMP
.default-subtype
rm
$TIMESTAMP
.default-subtype
nova flavor-create
--is-public
true
vEOS.medium auto 2048 0 1
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 must 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:
#
...
...
This diff is collapsed.
Click to expand it.
create-f5-bigip-image/create-f5-big-ip-image.sh
+
166
−
166
View file @
4ca0613a
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment