This is a very detailed example on how to build a L3 VPN, but could be anything, from scratch. This includes service types, templates, relations, scenarios, jobs, etc…
The use case for which we are going to develop an end to end workflow is of provisioning a L3VPN. The Topology is as shown below.
CustA want a L3VPN from CEA1 to CEA2 and CustB want a L3VPN from CEB1 to CEB2.
To go about delivering L3VPNs in CSP network, we have to perform following steps.
Some populating the database steps are necessary before we start with Service Type. They are:
Create Node Class and Node Types
We need to create two Node class and node types for PE and CE respectively as below:
Create Node Types
Now, for both the Node Types, Pls edit/update the following details
Create IPv4 Plans
Click New and provide following details:
Under Subnets section, create following subnets
Under Subnet Plans section, create a new “Loopback Reference” plan with loopback reference as “lo0”
Under Subnet Plans section, create a new “Loopback Reference” plan with loopback reference as “lo0”
Under Subnet Plans section, create a new “Loopback Reference” plan with loopback reference as “lo0”
2nd IPV4 plan is for PE_CE links
Under Subnets section, create following subnets
Under Subnet Plans section, create a new “Point-to-point” plan
We need to create several templates
1) vrf template
2) port templates
3) sub templates
4) Main templates
template | template type | vendor type | model name |
---|---|---|---|
vrf_template | port | Cisco_IOS | vrf |
Template text:
ip vrf <vrf_Name> rd <Vrf_rd> route-target both <Vrf_rt>
Note: As with all templates, do not forget to set your new template to the 'production' state
template | template type | vendor type | model name |
---|---|---|---|
AddVrf | port | Cisco_ios | Ethernet |
Template text:
#reload PE_CE_nets interface <Port_type><Slot_id>/<Port_id> ip vrf forwarding <Vrf_name> ip address <If_ip_N> <Net_mask> no shut
template | type | vendor |
---|---|---|
addMPbgp | automation | Cisco_IOS |
Template text:
router bgp <Rtg_bgp_as> address-family ipv4 vrf <Vrf_name> redistribute static redistribute connected ! ! !
Following Service Types need to be created
AddCE: To Add a CE with its loopback address
AddPE: To Add a PE with its loopback address
Create: To Create a L3VPN on a PE to PE basis
AddCE
Client Type: CSP
Service Class: CE
Service Type: api
Service Task: AddCE
Seq | Exec | Class | Scope | Match | Value | Alias | Comments |
---|---|---|---|---|---|---|---|
1 | LOCATE | CLIENT | CURRENT | CLIENT_CODE | (client) | <customer> | |
2 | ADD | SITE | <customer> | SITE_CODE | (site) | <ce.site> | |
3 | ADD | SERVICE | <ce.site> | CURRENT | AddCE | <ce.svc> | |
4 | ADD | NODE | <ce.svc> | NODE_TYPE | ISR3800 | <ce.node> | |
5 | ASSIGN | NODE | <ce.node> | NODE_NAME | (ce.name) | ||
6 | ASSIGN | NODE | <ce.node> | TEMPLATE | ISR | ||
7 | ADD | PORT | <ce.node> | LOOPBACK | Lo0 | <ce.lo0> | |
8 | ADD | SUBNET | <ce.svc> | NET_NAME | CE_Loopback | <ce.subnet> | |
9 | LOCATE | ADDRESS | <ce.subnet> | ADDRESS_FIRSTFREE | <ce.add> | ||
10 | ASSIGN | ADDRESS | <ce.add> | PORT | <ce.lo0> |
AddPE
Client Type: CSP
Service Class: PE
Service Type: api
Service Task: AddPE
Seq | Exec | Class | Scope | Match | Value | Alias | Comments |
---|---|---|---|---|---|---|---|
1 | LOCATE | CLIENT | CURRENT | CLIENT_CODE | (client) | <client> | |
2 | ADD | SITE | <client> | SITE_CODE | (site) | <site> | |
3 | ADD | SERVICE | <site> | CURRENT | (pe.site) | <addpe.svc> | |
4 | ASSIGN | SERVICE | <addpe.svc> | SERVICE_NAME | AddPE | ||
4 | ADD | NODE | <addpe.svc> | NODE_TYPE | C7600 | <pe.node> | |
5 | ASSIGN | NODE | <pe.node> | NODE_NAME | (pe.name) | ||
6 | ASSIGN | NODE | <pe.node> | TEMPLATE | c7600 | ||
7 | ADD | PORT | <pe.node> | LOOPBACK | Lo0 | <pe.lo0> | |
8 | ADD | SUBNET | <addpe.svc> | NET_NAME | PE_Loopbacks | <pe.loopback> | |
9 | LOCATE | ADDRESS | <pe.loopback> | PICK_FORCED | (pe.lo0.ip) | <pe.lo0.ip> | |
10 | ASSIGN | ADDRESS | <pe.lo0.ip> | PORT | <pe.lo0> | ||
11 | LOCATE | PORT | <pe.node> | PORT_TEMPLATE_FIRSTNOTOPO | AddVrf | <pe.port> | |
12 | ADD | SUBNET | <addpe.svc> | NET_NAME | PE_CE | <pe.ce.subnet> | |
13 | LOCATE | NODE | GLOBAL | NODE_NAME | (ce.node) | <ce.node> | |
14 | LOCATE | PORT | <ce.node> | PORT_TEMPLATE_FIRSTNOTOPO | ISR3800 | <ce.port> | |
15 | ADD | LINK | <pe.port> | PORT | <ce.port> | <pe.ce.link> | |
16 | ASSIGN | SUBNET | <pe.ce.subnet> | LINK | <pe.ce.link> | ||
17 | ADD | VRF | <ce.node> | VRF_NAME | (vrf) | <ce.vrf> | |
18 | ADD | VRF | <pe.node> | VRF_NAME | (vrf) | <pe.vrf> | |
19 | ASSIGN | SUBNET | <pe.ce.subnet> | VRF | <ce.vrf> | ||
20 | ASSIGN | SUBNET | <pe.ce.subnet> | VRF | <pe.vrf> |
Create
Client Type: CSP
Service Class: PE
Service Type: api
Service Task: Create
Seq | Exec | Class | Scope | Match | Value | Alias | Comments |
---|---|---|---|---|---|---|---|
1 | LOCATE | CLIENT | CURRENT | CLIENT_CODE | (client) | <client> | |
2 | ADD | SITE | <client> | SITE_CODE | (site) | <site> | |
3 | LOCATE | SERVICE | GLOBAL | NODE | (pe.node) | <pe.l3vpn.svc> | |
4 | LOCATE | NODE | GLOBAL | NODE_NAME | (pe.node) | <pe.node> | |
5 | LOCATE | PORT | <pe.node> | PORT_TEMPLATE_FIRSTNOTOPO | AddVrf | <pe.port> | |
6 | ADD | SUBNET | <pe.l3vpn.svc> | NET_NAME | PE_CE | <pe.ce.subnet> | |
7 | LOCATE | NODE | GLOBAL | NODE_NAME | (ce.node) | <ce.name> | |
8 | LOCATE | PORT | <ce.node> | PORT_TEMPLATE_FIRSTNOTOPO | ISR3800 | <ce.port> | |
9 | ADD | LINK | <pe.port> | PORT | <ce.port> | <pe.ce.link> | |
10 | ASSIGN | NODE | <pe.node> | NODE_POSITION | NA | ||
11 | ASSIGN | NODE | <pe.node> | NODE_POSITION | ZA | ||
12 | ADD | VRF | <ce.node> | VRF_NAME | (vrf) | <ce.vrf> | |
13 | ADD | VRF | <pe.node> | VRF_NAME | (vrf) | <pe.vrf> | |
14 | ASSIGN | VRF | <vrf> | VRF_TEMPLATE | vrf_template | ||
15 | ASSIGN | VRF | <vrf> | SUBNET | <pe.ce.subnet> |
Relations are required to fetch information out of the database. Here this use case assumes we have PE, CE and VRF information with us beforehand
Thus with the variables at hand, how can we retrieve other parameters which the Job will need. For e.g, we shall need the PE Interface Name as an input, this will be retrieved using relations
Name:PE_CE_nets
Description: Show all connected ptp subnets to CE's from PE.
SQL:
SELECT DISTINCT Port_map.Port_type, Port_map.Slot_id, Port_map.Port_id, Port_map.Port_template, Port_map_1.Hostname AS Rem_hostname, SiteRouter.Node_position AS Rem_node_position, Ip_subnet.Net_name, Ip_map.Ip_parameter, Ip_subnet.Net_address, Ip_subnet.Net_size, Ip_subnet.Net_mask, Ip_subnet.Net_ip_gateway, Ip_subnet.Net_ip_NA, Ip_subnet.Net_ip_NB, Ip_subnet.Net_ip_ZA, Ip_subnet.Net_ip_ZV, Ip_subnet.Net_ip_ZB, Ip_subnet.If_ip_N, Ip_subnet.If_ip_Z, Ip_subnet.If_ip_A, Ip_subnet.If_ip_B, Ip_subnet.If_loopback, Node_vrf.Vrf_name FROM (((((Port_map INNER JOIN Topo_map ON Port_map.Interface_id = Topo_map.Interface_id) INNER JOIN Topo_map AS Topo_map_1 ON Topo_map.Topo_id = Topo_map_1.Topo_id) INNER JOIN Port_map AS Port_map_1 ON Topo_map_1.Interface_id = Port_map_1.Interface_id) INNER JOIN SiteRouter ON Port_map_1.Hostname = SiteRouter.Hostname) INNER JOIN Port_map AS Port_map_2 ON SiteRouter.Hostname = Port_map_2.Hostname) INNER JOIN (Ip_map INNER JOIN Ip_subnet ON Ip_map.Subnet_id = Ip_subnet.Subnet_id) ON Port_map_2.Interface_id = Ip_map.Interface_id LEFT JOIN Node_vrf ON Ip_subnet.Vrf_id = Node_vrf.Vrf_id WHERE Port_map.Hostname = '<hostname>' AND Port_map_1.Interface_id != Port_map.Interface_id AND Ip_subnet.Net_name = 'PE_CE' ORDER BY Port_map_1.Hostname
The output (for e.g is below) :
And if we scroll to right to see the remaining columns
We can spot the IP addresses assigned and the VRF name too.
As shown in the snapshot, The Command Job has two sections
1) Commands:
2) Scenario
The Commands section has below:
{<Vrf_template@Node_vrf>, Node_vrf, Vrf_name = '<Vrf_name>'} ! {<Port_template@PE_CE_nets>, PE_CE_nets, Rem_hostname = '<CE_node>'} ! {addMPbgp}
The {<Vrf_template@Node_vrf>, Node_vrf, Vrf_name = '<Vrf_name>'}
Here <Vrf_template@Node_vrf> is substituted with the lines in the Vrf_template by querying the relation Node_vrf.
Whilst Node_vrf returns a lot of columns, we are interested in Vrf_template and Node_vrf variable's values which are substituted in the Vrf_template's execution, PROVIDED Vrf_name = value_of_vrf_specified_in_Scenario
In other words
<Vrf_template@Node_vrf> will give the assigned vrf template which will be called upon. The variables within that template are filled with the values in Node_vrf (the second part of the function) per line. The last part in the function (optional) will filter the query output with the assigned value.
For e.g, this is the output we expect from the above line:
ip vrf CustA rd 172.31.0.11:1 route-target both 65001:1 !
Here in the {<Port_template@PE_CE_nets>, PE_CE_nets, Rem_hostname = '<CE_node>'} line, we substitute the Port_template value from the relation PE_CE_nets
We also then expand the lines in the Port_template and start substituting parameters in PE_CE_nets PROVIDED Rem_hostname = value_of_CE_hostname_specified_in_Scenario
For e.g, this is the output we expect from the above line:
interface Ethernet1/2 ip vrf forwarding CustA ip address 5.5.5.1 255.255.255.252 no shut
In the {addMPbgp} line, we are calling addMPbgp template. All the values in the variables within addMPbgp template are substituted by either explicit input provided in the Scenario.
For e.g, this is the output we expect from the above line:
router bgp 65001 address-family ipv4 vrf CustA redistribute static redistribute connected !
Thus we have shown how to deploy L3 VPN on a PE for a set of parameters…
This is the last part of the howto where the rubber meets the road. Here, the jobs are scheduled as per the time of the day, day of the week OR
NoW
And the device gets configured as per schedule.
We can see the session transaction log in Operate ⇒ Job Logs:
PE1#show privilege Current privilege level is 15 PE1#show privilege Current privilege level is 15 PE1#configure terminal Enter configuration commands, one per line. End with CNTL/Z. PE1(config)#ip vrf CustA PE1(config-vrf)#rd 172.31.0.11:1 PE1(config-vrf)#route-target both 65001:1 PE1(config-vrf)#! PE1(config-vrf)#interface Ethernet1/2 PE1(config-if)#ip vrf forwarding CustA PE1(config-if)#ip address 5.5.5.1 255.255.255.252 PE1(config-if)#no shut PE1(config-if)#! PE1(config-if)#router bgp 65001 PE1(config-router)# address-family ipv4 vrf CustA PE1(config-router-af)# redistribute static PE1(config-router-af)# redistribute connected PE1(config-router-af)# ! PE1(config-router-af)# ! PE1(config-router-af)#! PE1(config-router-af)#end PE1#
Here are two more articles that explain the modification and deletion of the L3VPN.