Introduction
I had to do some SDN stuff with Arista switches at work, but I didn't have an actual machine, so I was looking for a quick way to try it out.
Many things in the world have become containerized and convenient, and Arista's switch also seems to have a containerized version called cEOS.
Let's launch the container version of EOS
Get a container image from the Arista official site
You will be able to download a image by signing up at the Arista official site. Click the Login
at the top of the page.
Looks that 4.25.1F
is the latest, let' use it.
Import the image to docker
$ docker import cEOS-lab-4.25.1F.tar ceos:4.25.1F
sha256:cfc9238775466cd246a24a213852cb235d2c36256c81e9969f89d431a49b4649
$ docker images
REPOSITORY TAG IMAGE ID CREATED SIZE
ceos 4.25.1F cfc923877546 6 minutes ago 1.69GB
Create a container and run
docker create \
--name=ceos6 \
-p 8080:80 \
--privileged \
-e INTFTYPE=eth \
-e ETBA=1 \
-e SKIP_ZEROTOUCH_BARRIER_IN_SYSDBINIT=1 \
-e CEOS=1 -e EOS_PLATFORM=ceoslab \
-e container=docker \
-i -t ceos:4.25.1F /sbin/init \
systemd.setenv=INTFTYPE=eth \
systemd.setenv=ETBA=1 \
systemd.setenv=SKIP_ZEROTOUCH_BARRIER_IN_SYSDBINIT=1 \
systemd.setenv=CEOS=1 \
systemd.setenv=EOS_PLATFORM=ceoslab \
systemd.setenv=container=docker
I will call the eAPI using port 8080 from my host.
$ docker start ceos6
$ docker ps
CONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES
3a61f13b3761 ceos:4.25.1F "/sbin/init systemd.โฆ" 18 seconds ago Up 1 second 0.0.0.0:8080->80/tcp ceos6
Port mapping is available.
$ docker port ceos6 80
0.0.0.0:8080
How to get to the EOS CLI
Just give Cli
at the end of the docker command, then.... Hello EOS world!
$ docker exec -i -t ceos6 Cli
localhost>en
localhost#conf t
localhost(config)#show run
! Command: show running-config
! device: localhost (cEOSLab, EOS-4.25.1F-20001546.4251F (engineering build))
!
transceiver qsfp default-mode 4x10G
!
service routing protocols model ribd
!
agent Bfd shutdown
agent PowerManager shutdown
agent LedPolicy shutdown
agent Thermostat shutdown
agent PowerFuse shutdown
agent StandbyCpld shutdown
agent LicenseManager shutdown
!
spanning-tree mode mstp
!
no aaa root
!
no ip routing
!
management api http-commands
protocol http
no shutdown
!
end
Set up the API
Let's enable the API access at the management port. The default setting is as follows.
localhost#show management api http-commands
Enabled: No
HTTPS server: enabled, set to use port 443
HTTP server: shutdown, set to use port 80
Local HTTP server: shutdown, no authentication, set to use port 8080
Unix Socket server: shutdown, no authentication
VRFs: None
Hits: 0
Last hit: never
Bytes in: 0
Bytes out: 0
Requests: 0
Commands: 0
Duration: 0.000 seconds
SSL Profile: none
FIPS Mode: No
QoS DSCP: 0
Log Level: none
CSP Frame Ancestor: None
TLS Protocols: 1.0 1.1 1.2
Add some configurations...
localhost#conf t
localhost(config)#management api http-commands
localhost(config-mgmt-api-http-cmds)#no protocol http
localhost(config-mgmt-api-http-cmds)#protocol http
localhost(config-mgmt-api-http-cmds)#no shutdown
localhost(config-mgmt-api-http-cmds)#wr mem
Copy completed successfully.
Now the API looks working.
localhost(config)#show management api http-commands
Enabled: Yes
HTTPS server: running, set to use port 443
HTTP server: running, set to use port 80
Local HTTP server: shutdown, no authentication, set to use port 8080
Unix Socket server: shutdown, no authentication
VRFs: default
Hits: 0
Last hit: never
Bytes in: 0
Bytes out: 0
Requests: 0
Commands: 0
Duration: 0.000 seconds
SSL Profile: none
FIPS Mode: No
QoS DSCP: 0
Log Level: none
CSP Frame Ancestor: None
TLS Protocols: 1.0 1.1 1.2
Access to the port with a web browser
...oh, you need an login account
Create a user account
localhost#conf t
localhost(config)#username <username> secret 0 <password>
You can check the user configuration by show run
GUI
You can do many things with the web UI.
There are two tabs. In the Simple Request
, it will convert EOS CLI command into JSON request. Script Editor
is to write JavaScript with the SDK.
You can find other language SDK such as go
, python
, ruby
... in Arista's GitHub
Enjoy SDN! ;)