How to Treat a Network
as a Container
(or get close)
Cisco DevNet Create | 2018
whoami
rosemary wang
platform & infra
@thoughtworks
@joatmon08
“digital transformation”
regressive automated
compute
regressive automated
build
ship
run
network
???????????
99 problems
terminology
api
non-standard
“distributed system”
protocols are specialized
+94 more
connectivity
service discovery
policy
network
regressive automated
physical containers
dynamic
infrastructure*
*software-defined X / public cloud
build
ship
run
test
test
test
TEST
E2E
Integration
Service/Contract
Unit
Manualcost
validate
configuration
confirm
interaction
validate
interaction
“the real deal”
“The Testing Pyramid”
Manualcost
E2E
Integration
Service/Contract
Unit
“The Testing Signpost”
build
Given ⇨ the component to automate ⇨ Setup
When ⇨ some event happens ⇨ Automation
Then ⇨ the component should be configured ⇨ Test
connectivity
https://github.com/joatmon08/2018-cisco-devnet-create
topology from http://docker-k8s-lab.readthedocs.io/en/latest/docker/docker-ovs.html
Smoke Test
tests/smoke/features/connectivity.feature
Ansible Playbook
playbook/
Mock Virtual Device
joatmon08/openvswitch-docker
connectivity
unit: check_openvswitch_playbook
Creates a Vagrant box with Open vSwitch image, checks that the
playbook runs to completion.
lint_yaml lint_python check_ansible_syntax
Make sure spacing & syntax is good.
integration: bootstrap
sh -c '. venv/bin/activate; cd tests/smoke && behave'
Creates two Open vSwitch hosts via Vagrant, runs playbook,
creates a container on each and checks connectivity.
contract: bootstrap
sh -c '. venv/bin/activate; pytest tests/contract --capture=no'
Create Open vSwitch host via Vagrant, captures output of Consul
Handler and compares to input of playbook
Same tests as integration, except on real device if I had one.
E2E
Integration
Service/Contract
Unit
makefile
testing the feature
list of tools
Vagrant: for virtual devices
Ansible: for device automation
Python: for coding
pytest: for running unit/service tests
behave: BDD for running integration tests
makefile: shortcuts for staging & running tests
Automation Tool
Linting Program
Testing Framework
Smoke Test
Testing Framework
Scripts/BDD
Smoke Test
test
Config/Template
Validation
Functional Validation
Output/Input
Certification
Staging/Production E2E
Integration
Service/Contract
Unit
ship
▢ names
▢ design principles
▢ common template/code formatting
▢ testing/development setup
▢ event triggers
set the standards
▢ quality review
▢ linting programs
▢ version control
▢ CI/CD framework
▢ documentation
enforce the standards
changes fail
when
patterns break
therefore,
test for
conformance
“..is an automated manifestation
of your process for getting
software from version control
into the hands of your users.”
Continuous Delivery: Reliable Software Releases through Build, Test, and Deployment Automation
a pipeline
When I need to ship anything,
then I should do it through a pipeline.
Unit Build Secure Monitor Perform DeployTest
Lint
Unit Test
Contract Test
Automation Smoke Test
Conformance
Tests
(can run async)
Production
Ready!
pipeline.gocd.yaml
run
upgrade
scale
secure
upgrade
in-place
blue/green
depends on
risk
configuration
connectivity
Given I have a container or software-defined network
When I need to upgrade that network*
Then I should create a new network with updated
configuration and use it.
*Assumes no IP address affinity
blue
compute
cluster
compute
orchestrator
blue
network
orchestrator
compute
cluster
compute
orchestrator
green
blue
network
orchestrator
compute
cluster
compute
orchestrator
green
“Deploy” Fan-Out
blue
network
orchestrator
compute
cluster
compute
orchestrator
green
“Deploy” Fan-Out
blue
network
orchestrator
compute
cluster
compute
orchestrator
green
50%50%
“Deploy” Fan-Out
blue
network
orchestrator
compute
orchestrator
green
100%
“Deploy” Fan-Out
network
orchestrator
compute
orchestrator
green
100%
“Deploy” Fan-Out
networking is challenging
invest in tests
patterns & standards are useful
learn more
▢ hack
▢ read examples
▢ repurpose
▢ befriend a network engineer / qa / dev
thank you!
@joatmon08
https://goo.gl/oc2ySq
https://github.com/joatmon08/2018-cisco-devnet-create

2018 Cisco DevNet Create : How to Treat a Network as a Container