Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web...

21
Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

Transcript of Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web...

Page 1: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

Akshat Sharma, TME, Web Solutions, Cisco.

October, 2016

Test your way to a better Deployment!

Page 2: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

2

Deployment and Operations: Current Methodology

2

Purchase   Installa.on    (Truck  Roll)  

Service  Ac.va.on  

Network Deployment is pretty Straightforward ….

Automated  NetOps:    ZTP,  Config  Mgmt….  

Page 3: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

3

Deployment and Operations: Current Methodology

3

Purchase  

Installa.on    (Truck  Roll)  

Service  Ac.va.on  

…maybe a bit of Pre-staging…

NetOps:    ZTP,  Config  Mgmt….  

Pre-­‐Staging  

Page 4: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

4

… A bit of monitoring, some hands-on deck, more truck-rolls when things go south…….

4

Purchase  

Installa.on    (Truck  Roll)  

Service  Ac.va.on  

NetOps:    ZTP,  Config  Mgmt….  

Pre-­‐Staging  

Page 5: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

5

Ok, Network Deployment is complex! •  Hence the need for Validation and Test Cycles.

•  These cycles must model real-life deployments and variables.

•  Takes time – weeks… mostly months …

•  Considerable investment on testing hardware and on good Testers/Developers.

Page 6: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

6

Deconstructing Network Test and Validation

Page 7: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

7

Validation Cycle Requirements Representative

Test Environments Time and Cost

Constraints

Time: Reduce months to weeks

Cost: •  Reduce man-hour

investment •  Reduce CAP-EX

on Test hardware

DC DC

Core

Exhaustive Automated Tests

•  Cover Test Topographies / Scenarios

•  Actions: •  Functional •  Negative

•  Validations

Page 8: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

8

The problems at hand… •  Vendor network protocol implementations are notoriously

difficult to test

•  Custom Vendor specific APIs

•  Lack of Models: No consensus on outputs/responses and capabilities

•  Non-overlapping tool coverage : Ansible coming close to

multi-vendor support but no other alternative.

•  Cannot commit to one tool over the other. Test Frameworks need to be modular.

Page 9: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

9

Creating an open-source Test Framework: Our Journey

Page 10: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

10

The 5 Commandments:

•  Workflow and Tool selection should never be bound by architectures. Be Flexible.

•  Keep the stack modular and composable.

•  Re-use existing industry tools – Do NOT start from scratch unless there is a gap.

•  Create a community to share test cases and extend libraries.

•  Stand on the shoulders of giants: Leverage work already done by communities like opendaylight, fd.io etc.

Page 11: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

11

Creating one piece at a time…

Page 12: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

12

Topologies A network is just an undirected graph. Nodes and Edges with certain properties that form the connections.

DC DC

Core

Page 13: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

13

Topologies Define a schema, put it in YAML or JSON and run kwalify tests to verify the input is valid.

Schema schema;topology_metadata_map: type: map mapping: version: type: any schema: …. schema;type_interfaces: type: map mapping: &type_interface_mapping regex;(port\d+): &type_interface_mapping_port type: map mapping: &type_interface_mapping_port_mapping name: type: str …..

--- metadata: version: 0.1 schema: - <path-to-schema-file> tags: [vagrant] nodes: DUT1: type: DUT host: "192.168.255.101" port: 22 username: password: i interfaces: port1: mac_address: "” driver: e1000 .....

YAML

kwalify

Page 14: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

14

The orchestrator

Verified YAML/JSON

Topology type: •  Physical •  Virtual

Physical: (No action)

Launch

Vagrant VIRL OpenStack

Verify Topology

Connection

objects

Orchestrator

•  Parse the topology, launch(if needed), verify and return connection objects.

•  The orchestrator could be Jenkins, Ansible, test-kitchen or something similar.

Page 15: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

15

The Test framework •  Dozens of tools available – BDD, Data Driven Test , Keyword Driven

Test, etc. •  We wanted our test cases to be inherently shareable.

•  So we made a bold assertion: Test cases should not be written in code.

•  Keyword driven Tests won and we chose http://robotframework.org/

Page 16: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

16

The Test Suite Structure

Topography/Scenario

Topology-independent Actions: -  Action 1, validation 1 -  Action 2, validation 2 -  ….

Validation

eg. Define Device roles and set up an L3VPN topology

eg. •  Clear BGP neighbors •  Flap interface etc.

Validates that the scenario works post all the actions.

•  Topography/Scenario is topology dependent.

•  The entire test suite is

written only using keywords.

•  Keywords are exposed by the Robot-framework Libraries.

•  These test cases can be shared with the community

Page 17: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

17

The Test libraries – Model Driven

robotframework

Topography/Scenario

Topology-independent Actions: -  Action 1, validation 1 -  Action 2, validation 2 -  ….

Validation

MD-test library

ydk-py

Ansible

Keywords Napalm

Model-Driven Actions and Validations

Page 18: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

18

Bringing it all together

Launch Verify Topology

Orchestrator

Topography/Scenario

Topology-independent Actions: -  Action 1, validation 1 -  Action 2, validation 2 -  ….

Validation

MD-test library

robotframework

Testers Framework Developers DUT/SUT

Page 19: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

19

Shareable BGP Tests written using robotframework.

Demo!

BGP

OSPF OSPF PE1

PE2 P

Page 20: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

20

Check us out on Github!

•  Robo-YDK organization: https://github.com/roboydk

•  Robotframework YDK library: https://github.com/roboydk/roboydk

•  Ansible-Topology Orchestration: https://github.com/roboydk/orchestrator

•  Packet Injection based topology verification: https://github.com/roboydk/topo-verify

Page 21: Test your way to a better Deployment! - NANOG Archive · 2018-07-27 · Akshat Sharma, TME, Web Solutions, Cisco. October, 2016 Test your way to a better Deployment!

21

Thank you!