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
5c9dffe5
Commit
5c9dffe5
authored
8 years ago
by
Sebastian Rieger
Browse files
Options
Downloads
Patches
Plain Diff
fixed default subtype creation to support VIRL version <1.3
parent
27fd3d25
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
create-arista-veos-image/create-arista-veos-image.sh
+59
-22
59 additions, 22 deletions
create-arista-veos-image/create-arista-veos-image.sh
with
59 additions
and
22 deletions
create-arista-veos-image/create-arista-veos-image.sh
+
59
−
22
View file @
5c9dffe5
...
@@ -15,6 +15,7 @@
...
@@ -15,6 +15,7 @@
# V1.4.1 fixed check for existing images
# 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.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
# usage
# usage
if
[
!
$#
-eq
3
]
;
then
if
[
!
$#
-eq
3
]
;
then
...
@@ -318,7 +319,7 @@ else
...
@@ -318,7 +319,7 @@ else
fi
fi
# create deault subtype
# 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": [
"dynamic-subtypes": [
{
{
...
@@ -345,16 +346,52 @@ cat << EOF > dynamic-subtype-$GLANCE_IMAGE_NAME.json.default
...
@@ -345,16 +346,52 @@ cat << EOF > dynamic-subtype-$GLANCE_IMAGE_NAME.json.default
]
]
}
}
EOF
EOF
CHECKING_FOR_EXISTING_SUBTYPE
=
$(
virl_uwm_client subtype-info 2>&1 |
grep
$GLANCE_IMAGE_NAME
)
cat
<<
EOF
> dynamic-subtype-
$GLANCE_IMAGE_NAME
.json.default.virl-below-1.3
if
[
$?
==
1
]
;
then
{
"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
"Creating default subtype
$GLANCE_IMAGE_NAME
..."
echo
"==========================================================="
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
else
echo
"Default subtype
$GLANCE_IMAGE_NAME
already exists..."
echo
"Default subtype
$GLANCE_IMAGE_NAME
already exists..."
fi
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
echo
"Image creation successful."
echo
"Image creation successful."
...
...
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