ACI Introduction
ACI Introduction
ACI Introduction
Agenda
• Fabric Basics
• Policy Model
• Architectural Deployments
• Day 2 and beyond
• Conclusion
4
Fabric Basics
ACI: One Network, any location
100M/1/10/25/40/50/100/400G
ACI
Cloud
Containers
* *
#CiscoLive BRKDCN-1601 © 2023 Cisco and/or its affiliates. All rights reserved. Cisco Public 4
What is “Application Centric”?
• Traditional networks use ACL’s to
classify traffic
• Usually based on L3 or L2 addresses
• Makes security decisions (permit,
Host1
deny, log, etc) EPG1
5
ACI Anywhere
IP WAN IP WAN
6
App Centric Design
Its about Continuous Improvement
• Zero Trust is a journey
• Different Environments have different requirements
• Few Customers go all-in from Day1
• Any level of improved security is beneficial
• Never too late to start!
7
The DC network before The DC network NOW
Classic modular switching ACI
Supervisors (1 or 2)
APICs
(3 or more)
Fabric Modules (3-6)
Up to 18 RUs Scale-up
SPINE
(1 to 6)
Linecards (Copper, Fiber, 1/10G)
Zero-touch VXLAN
No STP
LEAVES
(1 to 400 or more*) Scale as you need
BEFORE
11
ACI: How difficult was it to bring up?
What tasks & configuration did ACI just saved me from doing manually on every switch
BEFORE
12
ACI: How difficult was it to bring up?
What tasks & configuration did ACI just saved me from doing manually on every switch
BEFORE NOW
External to Internal Route redistribution
& Control Plane (MP-BGP, QoS, etc)
13
ACI Policy Model
Simplified
The ACI Policy Model
Tenant ≈ VDC
15
The ACI Policy Model – Migrating into ACI
Tenant
VRF
VLAN 30 BD VLAN 30 BD
10.10.10.1/24 10.10.30.1/24
VLAN 30 EPG
16
The ACI Policy Model – Migrating into ACI
Tenant
Global VRF/Routing Table and Protocol Connect
To External
Switch
VLAN 10 BD VLAN 20 BD VLAN 30 BD
10.10.10.1/24 10.10.20.1/24 10.10.30.1/24
L2 External
(802.1q Trunk)
VLAN 10 EPG VLAN 20 EPG VLAN 30 EPG
L3 External
(Routed Interface)
Tenant
Global VRF/Routing Table and Protocol Connect
To External
Switch
VLAN 10 BD
10.10.10.1/24
L2 External
AD_SVR Prod_SQL Print Svc (802.1q Trunk)
XenApp
VLAN 10 EPG
VM VM VM
VM VM L3 External
VM
(Routed Interface)
VM VM
Tenant
Global VRF/Routing Table and Protocol Connect
To External
Switch
VLAN 10 BD VLAN 20 BD VLAN 30 BD
10.10.10.1/24 10.10.20.1/24 10.10.30.1/24
L2 External
VLAN 10 EPG VLAN 20 EPG (802.1q Trunk)
AD EpSG
VLAN 30 EPG
L3 External
Print Svc EpSG (Routed Interface)
19
Advancing the ACI Configuration
App 1 - App 1 -
App Tier Web Tier L2/L3
External
To DB
Only SQL
Only tcp/2048 Only HTTPS
IP WAN IP WAN
22
ACI MultiPod
The evolution of a stretched fabric
Inter-Pod IP Network*
w/PIM BiDir support
Site A Site B
23
ACI: Physical Remote Leaf
Extend ACI to Satellite Data Centers
Port Speed:
1-400G
Site A Remote
Location
VM VM VM VM VM VM VM VM VM VM VM VM VM VM
Zero Touch Auto Two switches per site Stretch EPG, BD, VRF, DC Migration /
Discovery of Remote Leaf Up To 200 Remote Leaf Tenant, Contract OTV replacement
Switches (ACI 6.0) – 300ms
24
ACI Multi-Site Nexus Dashboard
Orchestrator Consistent Policy across sites
Single Point of Orchestration
Fault Isolation
Scale
Site A
Site D
Site B
VM VM VM
VM VM VM
VM VM VM
Scale
Site A
Site C
Site D
Site B
VM VM VM
VM VM VM
VM VM VM
IP SG
Web
SG Rule
SG
APP SG Rule
SG
DB
EPG
Contract
EPG
Contract
EPG Network
Web APP DB
AWS Region
IP
Network ASG ASG ASG
NSG NSG
Web APP DB
VM VM VM
Azure Region
27
The network-admin challenge
Provisioning and monitoring complexity = Risk
NX- OS ACI
Subscription/
Separate Infrastructure + Tenant Account Account/Project
Resource Group
VXLAN
Bridge Domain/
VLAN CIDR/Subnet Subnet Subnet
Subnet
Access-list (ACL) Contracts & Filters Security Group Rules Security Rules Firewall Rules
28
For your info
& reference
29
For your info
& reference
Network Adapter
30
ACI Day 2 and Beyond
Making ACI Hum
Cloud Networking: Challenges
Connectivity and management
Workloads are increasingly distributed and diverse.
Complex to connect workloads across multiple
public cloud providers, data centers and edge
locations.
Colocation
Zero trust and security
Workload migration and mobility of users imposes
Private
cloud IoT significant challenges to enforce right security
edge policies across different environments.
Cisco
Nexus
Insights Fabric Discovery
Dashboard
Simple to automate, Data Broker
Consume all services in one place
SAN Controller
simple to consume
Private cloud Public cloud Third-party Connectors
33
SPAN and Tap Aggregation with Data Broker
Production Network Packet Broker Network Tools
Production Network
Types
IDS
Packet
Sniffer
1 2 3
Benefits
Data
enrichment
Event correlation
Cisco Nexus
Dashboard Insights
Artificial
intelligence and
machine learning
Software and
hardware telemetry -
from switches and APIC
35
Cisco Nexus Dashboard Insights
Use cases and benefits
Identify, locate, root Upgrade
cause, remediate impact advisories
Error detection,
Mitigate
latency, packet drops
Prevent outages
Control plane issue
Hardening checks
Automated alerts
Availability Software hardware
Explorer
Insights recommendations
36
Key Takeaways
• Consistent SDN enabled network policy across all the switches
within a fabric
37
Application Centric Design
App Centric Design
Its about Continuous Improvement
• Zero Trust is a journey
• Different Environments have different requirements
• Few Customers go all-in from Day1
• Any level of improved security is beneficial
• Never too late to start!
39
Importance of Application Segmentation
40
ACI’s Path to Improved Security
41
Application Security Enforcement Points
42
Review: Logical Policy in ACI
Tenant 1
VRF1
Routing Domain (IP
forwarding)
43
Do your ACI Policies look like this?
Subnet Aligned
CL2023_tn
Prod_vrf
Prod_ap
any:any
extEPG
44
Or this?
VLAN Aligned
CL2023_tn
Prod_vrf
Prod_ap
any:any
extEPG
45
Or perhaps like this?
VLAN Aligned
CL2023_tn
Prod_vrf
Prod_ap
any:any
vzAny extEPG
46
Different Approaches to EPG Design in ACI
EPG/BD =
EPG = App Tier Hybrid
VLAN/Subnet
• EPG and BD for each • EPG per Application Tier, • Combination Approach
VLAN/Subnet sharing common BD
• Supports both Legacy &
• Most Commonly • Ideal for well-understood New Apps on same
Deployed Apps and/or Flat fabric
Network deployments
• Ease of Legacy • Introduces a path to an
Migration, Limited • Works well with Improved Security
Segmentation automation tools Model
• Increases operational
complexity
47
ACI Security
Features Toolbox
What’s in our ACI toolbox
vzAny
Endpoint Security Groups
L4-7 Service Graphs
ExGs
Intra-EPG Isolation
Endpoint Groups
Filters
Preferred Groups
Contracts
20
Endpoint Group
Endpoint Group (EPG)
Collection of endpoints, such as VMs, hosts, servers, physical devices
Internally represented by pcTag
Endpoint Group (EPG)
Use contracts to communicate to other EPGs
Can represent:
• Subnet/VLAN
• VMware port-group
• Application Tier
• Security zone
EPG1 EPG2
51
Endpoint Group Classification
52
Contracts
Contracts Review
• Traditional access lists are built between subnets, hosts, VLANs, MACs, and applied
to interfaces in a particular direction.
• ACI applies security to Endpoint Groups (EPGs) or Endpoint Security Groups (ESGs)
• Contracts use a Provider/Consumer model
• ACI is a whitelist model by default. That is, only communication which is explicitly
defined will be allowed.
• Any endpoint (EP) in an ExG can communicate by default with any other endpoint
inside the same ExG.
• When an EP needs to communicate to something outside of its ExG, a contract is
required
54
Contract Structure
Contract
55
Contract Scope
56
vzAny
Any ExG in VRF = vzAny
Tenant VRF1
• vzAny represents the collection of
EPGs/ESGs that belong to the same VRF, BD1
including L3 external.
EPG1
• Instead of associating contracts to each
individual ExG you can configure a contract
EPG2
to the vzAny
• With cross-VRF contracts, vzAny can be a BD2
consumer, not provider vzAny
EPG3
• Can also be used with Service Graphs
EPG4
ESG1
58
vzAny Example - Simplicity and TCAM Savings
EPG1
Five TCAM Entries *
EPG2
EPG
EPG Shared vzAny
Shared EPG3 Services
Services
EPG4
• Allows multiple different ExGs to freely communicate without the need for contracts
EPG EPG
3 6
VRF
61
Preferred Group - Config
1. 2a . 2b.
62
Intra-Group Isolation
(ESG/EPG)
Intra-ExG isolation & Intra-ExG Contract
backup-client DB-cluster
(EPG) Cluster Sync Only (EPG)
64
Intra-ExG Isolation & Intra-ExG Contracts
• Considerations:
• Requires Gen2+ HW & proxy-arp
• Supported on:
• Physical Domains (Baremetal Endpoints)
• VMware VMM vDS
• Microsoft Hyper-V VMM
• For VMM, PVLANs are leveraged
• Same applies for baremetal with intermediate switch
(External Switch App can automate this if using UCSM)
65
uSeg EPG
(Micro EPG / Microsegment EPG)
Understanding Micro EPGs
• A MicroEPG (uEPG) is equivalent to a regular EPG for all purposes, but
classification is based on endpoint attributes (and dynamic in nature)
• Endpoints assigned to the uEPG regardless of the encapsulation/port
• The endpoint must be first known to a regular
EPG, called “base EPG” Regular ‘Base’ EPG based on
port and encapsulation (P,V)
vlan100_epg
67
Understanding Micro EPGs
• A MicroEPG (uEPG) is equivalent to a regular EPG for all
purposes, but classification is based on endpoint attributes (and
dynamic in nature)
• Endpoints assigned to the uEPG regardless of the vlan100_epg
encapsulation/port
• The endpoint must be first known to a regular
VM-MyApp1
EPG, called “base EPG” BM-01
10.10.100.11
f4:5c:89:b2:bf:cb
BM-02
10.10.100.12 10.10.100.13
(OS: WIN2016)
f4:5c:89:b2:ab:cd
68
Understanding Micro EPGs
69
Attributes for Micro-Segmentation
70
Logical Operators
• VMs within the VMM domain called ACI-VDS and who’s name is prefixed with ‘Prod’
Match ANY
IP Equals 1.1.1.0/24
IP Equals 2.2.2.0/24
Match All
OR VM Name Starts With ‘Prod’
VMM Domain = ACI-VDS
72
Attribute Precedence
73
Endpoint
Security Group
What is an ESG (Endpoint Security Group)?
VRF A
BD 1 BD 2 BD 3 BD 4
192.168.1.254/24 192.168.2.254/24 192.168.3.254/24 192.168.4.254/24 Policies Needed: 6
EPG 1 EPG 2 EPG 3 EPG 4
(VLAN 2011) (VLAN 2022) (VLAN 2031) (VLAN 2041)
75
EPG vs. ESG
• ESG is a Security Group construct that can span BDs
VRF A
BD 1 BD 2 BD 3 BD 4
192.168.101.254/24192.168.102.254/24192.168.103.254/24192.168.104.254/24
Policies Needed: 1
EPG 1 EPG 2 EPG 3 EPG 4
(VLAN 111) (VLAN 102) (VLAN 103) (VLAN 104)
76
ESG Matching
77
Example Design using ESGs
Network Centric Hybrid Application Centric Security Group (ESG)
A security group in Multiple security groups Security groups across Security groups across
1 subnet in 1 subnet subnets bridge domains
Bridge Domain
Bridge Domain Bridge Domain BD BD
10.0.0.254/24
10.0.0.254/24 10.0.0.254/24 10.0.0.254/24 20.0.0.254/24
20.0.0.254/24
EPG (VLAN 10) EPG EPG EPG EPG EPG EPG EPG EPG
(VLAN 11) (VLAN 12) (VLAN 13) (VLAN 11) (VLAN 12) (11) (12) (VLAN 20)
• ESG contracts and BD subnets are deployed on all nodes where the VRF is deployed
• No automatic route leaking based on contracts
➢ No more subnets under a provider EPG
➢ Manual but simple route leaking config
79
ESG Considerations cont’d
• Only IP selector in 6.0. (/32, /128 or LPM such as /24)
➢ ESG can be applied only for routed traffic
➢ To prevent L2 traffic to bypass ESG security, Allow Micro-Segmentation, Intra EPG Isolation with Proxy-
ARP, or Intra EPG Contract needs to be enabled on each EPG where the endpoints originally belonged to.
80
ESG Contract Support Summary
Note:
Any contract features that are supported in uSeg EPG are supported
in ESG unless it’s explicitly mentioned as not supported on the right
81
Application Segmentation &
Putting it all together
Segmentation vs. Micro-Segmentation
Segmentation
Segment 2
Segment 3 Segment 1
Segment 4
83
Segmentation vs. Micro-Segmentation
Segment 2
Segment 2
Segment 1
Segment 3 Segment 1
Segment 4
Segment = Broadcast domain / VLAN / Subnet Micro Segment = Endpoint or Group of Endpoints
84
Zone Micro Segmentation
Segmentation Level: Low
172.16.10.0/24
Prod QA Dev
85
Application Segmentation
Segmentation Level: Medium
172.16.10.0/24
86
Application Tier Segmentation
Segmentation Level: High
172.16.10.0/24
Web App DB
87
Balancing App Segmentation vs. Complexity
Goldilocks Zone
Complexit
y
Granularity/Security
88
Sample Case
Study
Greenfield
Greenfield Case Study – Acme Inc.
91
Acme Inc. e - Com Application – EPG Deployment
web
load_balancer
apache1 apache2
EPG
net_services mysql nfs_server
L3EPG
ServiceGraph
92
Brownfield
Brownfield Case Study – Acme Inc.
94
Acme Inc. e - Com Application Summary
web
load_balancer
apache1 apache2
95
Acme Inc. e - Com Application Summary
web
vlan101 load_balancers
96
Acme Inc. e - Com App on ACI
ACME_tn
Prod_vrf
Prod_ap
? ? ?
? ?
?
97
Acme Inc. e - Com App on ACI
ACME_tn
Prod_vrf
Prod_ap
? ? ?
? ?
?
98
Acme Inc. e - Com App on ACI
ACME_tn
Prod_vrf
Prod_ap
E-Com_ap
Application Security Group: E-Com
auth- lb1 apache1 mysql net_svc
e-
serv1
com_
front
auth- mong lb2 apache2 nfs1
serv2 odb1
99
vCenter View
Tag & Category Assignment
100
ACI View 1 of 5
VMM Domain – Tag Collection
101
ACI View 2 of 5
Base EPGs VMM Domain Binding
102
ACI View 3 of 5
ESG – Tag Selector
103
ACI View 4 of 5
Base EPG – Learned Endpoints
104
ACI View 5 of 5
ESG – Matched Endpoints
105
Brownfield Migration of Net-Centric Apps to ESGs
106
Result
• Application-Level Health Visibility
• Application Segmentation – Increased Security
• No changes to legacy EPG mappings/VM Port Groups
• Optimized Policy TCAM
• Potential reduction of load on external FWs
• Ability to further segment Application into ‘tiers’
107
Nexus-as-Code
Kickstart your automation with ACI
• Infrastructure as Code
• Introduction to Nexus-as-Code
• Pre-Change Validation
• Automated Testing
Agenda
• CI/CD Integration
Infrastructure as Code
Infrastructure as code (IaC) is the process of managing and provisioning computer data
centers through machine-readable definition files, rather than physical hardware
configuration or interactive configuration tools.
Practicing infrastructure as code means applying the same rigor of application code
development to infrastructure provisioning. All configurations should be defined in a
declarative way and stored in a source control system.
113
Comparison
Native Terraform
resource "aci_tenant" "tenant_CiscoLive" {
name = "CiscoLive"
}
variable "vrfs" {
default = {
Nexus-as-Code
VRF1 = {
name = "VRF1" apic:
}, tenants:
VRF2 = { - name: CiscoLive
name = "VRF2" vrfs:
} - name: VRF1
} - name: VRF2
}
114
Comparison
Native Terraform
resource "aci_tenant" "tenant_CiscoLive" {
name = "CiscoLive"
}
variable "vrfs" {
default = {
Nexus-as-Code
VRF1 = {
name = "VRF1" apic:
}, tenants:
VRF2 = { - name: CiscoLive
name = "VRF2" vrfs:
} - name: VRF1
} - name: VRF2
}
115
Node Policies
• The data model is organized in a way that apic:
configurations are grouped around where the node_policies:
actual configuration (policy) is applied. nodes:
- id: 101
pod: 2
• All the configurations that are applied at the role: leaf
node level can be found under: serial_number: FDO13026BEN
apic - > node_policies - > nodes name: leaf-101
oob_address: 10.103.5.101/24
• This includes configurations typically found in oob_gateway: 10.103.5.254
different places in the ACI object tree, like for update_group: group-1
fabric_policy_group: all-leafs
example the OOB node management address, access_policy_group: all-leafs
which is configured under the mgmt tenant.
- id: 1
• Consolidating all node level configurations in a pod: 2
single place eases maintenance, as for example role: apic
oob_address: 10.103.5.1/24
we only have to update this single section when oob_gateway: 10.103.5.254
adding a new node.
116
Access Policies
• A number of profiles and selectors can be auto- apic:
generated by providing a naming convention. auto_generate_switch_pod_profiles: true
117
Access Policies
• A number of profiles and selectors can be auto- apic:
generated by providing a naming convention. auto_generate_switch_pod_profiles: true
118
Separate Data from Code
In order to ease maintenance we separate data (variable definition) from logic (infrastructure
declaration), where one can be updated independently from the other.
apic:
module "aci" {
tenants:
source = "netascode/nac-aci/aci"
- name: CiscoLive
version = "0.7.0"
vrfs:
- name: CiscoLive
yaml_directories = ["data"]
bridge_domains:
- name: vlan-100
manage_access_policies = true
vrf: CiscoLive
manage_fabric_policies = true
application_profiles:
manage_pod_policies = true
- name: dev
manage_node_policies = true
endpoint_groups:
manage_interface_policies = true
- name: vlan-100
manage_tenants = true
bridge_domain: vlan-100
}
physical_domains: ["l2"]
apic.yaml main.tf
119
ACI Terraform Provider
• Nexus-as-Code heavily relies on the resource "aci_rest_managed" "fvTenant" {
generic aci_rest_managed resource of the dn = "uni/tn-EXAMPLE_TENANT"
ACI Terraform provider. class_name = "fvTenant"
120
ACI Modules
• Terraform Modules allow us to introduce a level of abstraction similar to functions in
programming languages
• Where a Terraform resource typically represents a single ACI object, a Terraform module can
represent a branch in the object tree
Tenant
DHCP Static
Contract Domain
Option Path
121
ACI Module Example
• Modules allow us to break a configuration module "aci_endpoint_group" {
source = "netascode/endpoint-group/aci"
into more manageable pieces which can version = ">= 0.1.0"
be developed and tested independently
tenant = "ABC"
• Modules can be versioned and released application_profile = "AP1"
independently name = "EPG1"
bridge_domain = "BD1"
contract_consumers = ["CON1"]
• Modules enable easier shareability and cut physical_domains = ["PHY1"]
down on duplicate work as they can be vmware_vmm_domains = [{
shared with the wider community name = "VMW1"
(Terraform Registry) }]
static_ports = [{
node_id = 101
• Terraform recently introduced a testing
vlan = 123
experiment, which enables writing port = 10
integration tests for modules directly in }]
Terraform }
122
Nexus-as-Code Module
• Fabric Policies: Configurations applied at the fabric • Node Policies: Configurations applied at the node level
level (e.g., fabric BGP route reflectors) (e.g., OOB node management address)
• Access Policies: Configurations applied to external • Interface Policies: Configurations applied at the interface
facing (downlink) interfaces (e.g., VLAN pools) level (e.g., assigning interface policy groups to ports)
• Pod Policies: Configurations applied at the pod • Tenants: Configurations applied at the tenant level (e.g.,
level (e.g., TEP pool addresses) VRFs and Bridge Domains)
DHCP Static
Contract Domain
Option Path
123
YAML Layout
• As different teams might be responsible
for different parts of the infrastructure, it is $ tree -L 2
.
of paramount importance to allow enough ├── data
flexibility when defining and maintaining │ ├── apic.yaml
the ACI configuration. │ ├── access_policies.yaml
│ ├── fabric_policies.yaml
• The configuration can be split into multiple │ ├── node_policies.yaml
YAML files each for example covering a │ ├── pod_policies.yaml
specific logical section of the │ ├── node_1001.yaml
│ ├── node_101.yaml
configuration. │ ├── node_102.yaml
│ ├── tenant_PROD.yaml
• Nexus-as-Code does not dictate a │ └── defaults.yaml
specific schema, but instead allows for full └── main.tf
flexibilty to divide the configuration as
needed.
124
Deep Merge YAML Content
YAML files can be split at arbitrary points, meaning the Nexus-as-Code Module will combine and
deep merge the contents of YAML files, where data of two elements with the same keys will be
combined. This for example enables splitting the configuration of a single tenant in two YAML files.
apic: apic:
tenants: tenants:
- name: PROD - name: PROD
vrfs: vrfs:
- name: MANAGEMENT - name: HR
bridge_domains: bridge_domains:
- name: VLAN100 - name: VLAN200
vrf: MANAGEMENT vrf: HR
125
Sensitive Information
The configuration might contain sensitive information that should not be stored in cleartext in the
configuration. One common approach to handling secrets in the context of CI/CD Platforms is by
injecting sensitive values as environment variables during runtime.
apic:
access_policies:
mcp:
key: !env MCP_KEY
apic:
Secrets Storage access_policies:
mcp:
MCP_KEY: Cisco123Cisco123 key: Cisco123Cisco123
126
Data Model Documentation
127
Default Values
defaults:
• Nexus-as-Code comes with pre-defined apic:
default values based on common best tenants:
practices. bridge_domains:
name_suffix: _bd
• In some cases, those default values might unicast_routing: false
not be the best choice for a particular
deployment and can be overwritten if
defaults.yaml
needed.
• Appending suffixes to object names is a apic:
common practice that introduces room for tenants:
human errors. Using default values, such - name: CiscoLive
bridge_domains:
suffixes can be defined once and then - name: vlan_101
consistently appended to all objects of a - name: vlan_102
specific type including its references. - name: vlan_103
tenants.yaml
Unmanaged Parent Objects
In some cases you might only want to manage objects within a container.
The managed flag indicates if an object should be created/modified/deleted
or is assumed to exist already and just acts a container for other objects.
apic: apic:
tenants: tenants:
- name: Dev - name: Dev
- name: Stage managed: false
- name: Prod vrfs:
- name: VRF1
- name: VRF2
Pre-Change Validation iac-validate
A CLI tool to perform format, syntactic, semantic and compliance validation of Nexus-as-Code
YAML files.
$ iac-validate -h
Usage: iac-validate [OPTIONS] [PATHS]...
Options:
--version Show the version and exit.
-v, --verbosity LVL Either CRITICAL, ERROR, WARNING, INFO or DEBUG
-s, --schema FILE Path to schema file. (optional, default:
'.schema.yaml', env: IAC_VALIDATE_SCHEMA)
-r, --rules DIRECTORY Path to semantic rules. (optional, default:
'.rules/', env: IAC_VALIDATE_RULES)
-o, --output FILE Write merged content from YAML files to a new YAML
file. (optional, env: IAC_VALIDATE_OUTPUT)
-h, --help Show this message and exit.
Semantic Validation iac-validate
Semantic validation is about verifying specific data model related constraints like referential
integrity. It can be implemented using a rule based model like commonly done with linting tools.
Examples are:
• Check uniqueness of key values (eg. Node IDs)
• Check references/relationships between objects (eg. Interface Policy Group referencing a CDP
Policy)
A CLI tool to perform a pre-change analysis on Nexus Dashboard Insights or Network Assurance
Engine. It can either work with provided JSON file(s) or a terraform plan output from a Nexus-as-
Code project. It waits for the analysis to complete and evaluates the results.
$ nexus-pcv -h
Usage: nexus-pcv [OPTIONS]
Options:
-i, --hostname-ip TEXT NAE/ND hostname or IP (required, env:
PCV_HOSTNAME_IP).
-u, --username TEXT NAE/ND username (required, env: PCV_USERNAME).
-p, --password TEXT NAE/ND password (required, env: PCV_PASSWORD).
-d, --domain TEXT NAE/ND login domain (optional, default: 'Local',
env: PCV_DOMAIN).
-g, --group TEXT NAE assurance group name or NDI insights group
name (required, env: PCV_GROUP).
-s, --site TEXT NDI site or fabric name (optional, only required
for NDI, env: PCV_SITE).
Testing
There are certain aspects we can only verify after deployment like for example operational state.
Various testing frameworks can be used for that, one example would be Robot Framework.
Robot’s language agnostic syntax with libraries like Requests and JSONLibrary can be used to
write tests against REST APIs.
In combination with templating languages like Jinja we can render test cases dynamically based
on the desired state.
Tests can typically be categorized in three groups:
• Configuration Tests: verify if the desired configuration is in place
• Health Tests: leverage the in-built APIC fault correlation to retrieve faults and health scores and
compare them against thresholds and/or previous state
• Operational Tests: verify operational state according to input data, eg. BGP peering state
Testing iac-test
A CLI tool to render and execute Robot Framework tests using Jinja templating.
$ iac-test -h
Usage: iac-test [OPTIONS]
A CLI tool to render and execute Robot Framework tests using Jinja
templating.
Options:
-d, --data PATH Path to data YAML files. (env: IAC_TEST_DATA)
[required]
-t, --templates DIRECTORY Path to test templates. (env: IAC_TEST_TEMPLATES)
[required]
-f, --filters DIRECTORY Path to Jinja filters. (env: IAC_TEST_FILTERS)
--tests DIRECTORY Path to Jinja tests. (env: IAC_TEST_TESTS)
-o, --output DIRECTORY Path to output directory. (env: IAC_TEST_OUTPUT)
[required]
-i, --include TEXT Selects the test cases by tag (include). (env:
IAC_TEST_INCLUDE)
-e, --exclude TEXT Selects the test cases by tag (exclude). (env:
IAC_TEST_EXCLUDE)
--render-only Only render tests without executing them. (env:
IAC_TEST_RENDER_ONLY)
Robot/Jinja Example iac-test
{% endfor %}
CI/CD Workflow Example
1
Push to Workflow Syntax and Webex
Dev Branch feature branch triggered Semantic Validation notification
2
Operator Open GitHub Workflow Terraform NDI Pre-Change Webex
Pull Request Pull Request triggered Plan Analysis notification
3
Merge into Workflow Deployment Testing Run NDI Delta Webex
Main Branch main branch triggered Analysis notification
Scalability
By adding more and more objects to your $ tree -L 2
configuration a few problems can arise: .
├── data
• The Terraform state file becomes bigger and │ ├── apic.yaml
making changes with Terraform takes much │ ├── access_policies.yaml
│ ├── fabric_policies.yaml
longer. │ ├── node_policies.yaml
│ ├── pod_policies.yaml
• A single shared statefile is a risk. Making a │ ├── node_1001.yaml
change in a Development tenant could have │ ├── node_101.yaml
implications to a Production tenant. │ ├── node_102.yaml
│ ├── tenant_PROD.yaml
• No ability to run changes in parallel. Only one │ ├── tenant_DEV.yaml
concurrent plan may run at any given time as │ └── defaults.yaml
└── workspaces
the statefile is locked during the operation. ├── tenant_PROD
│ └── main.tf
• With Nexus-as-Code, state can be split into └── tenant_DEV
multiple workspaces while retaining a single set └── main.tf
of YAML files.