summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CONTRIBUTING.md75
-rw-r--r--Makefile1
-rw-r--r--data/configd-include.json1
-rw-r--r--data/templates/firewall/nftables-nat66.tmpl20
-rw-r--r--data/templates/frr/bgp.frr.tmpl2
-rw-r--r--data/templates/frr/isis.frr.tmpl6
-rw-r--r--data/templates/frr/ospf.frr.tmpl4
-rw-r--r--data/templates/frr/static.frr.tmpl17
-rw-r--r--data/templates/frr/vrf.frr.tmpl25
-rw-r--r--data/templates/https/nginx.default.tmpl4
-rw-r--r--debian/control3
-rw-r--r--interface-definitions/include/accel-ppp/auth-local-users.xml.i (renamed from interface-definitions/include/accel-auth-local-users.xml.i)4
-rw-r--r--interface-definitions/include/accel-ppp/auth-mode.xml.i (renamed from interface-definitions/include/accel-auth-mode.xml.i)4
-rw-r--r--interface-definitions/include/accel-ppp/auth-protocols.xml.i (renamed from interface-definitions/include/accel-auth-protocols.xml.i)4
-rw-r--r--interface-definitions/include/accel-ppp/client-ip-pool-start-stop.xml.i (renamed from interface-definitions/include/accel-client-ip-pool-start-stop.xml.i)4
-rw-r--r--interface-definitions/include/accel-ppp/client-ip-pool-subnet.xml.i (renamed from interface-definitions/include/accel-client-ip-pool-subnet.xml.i)4
-rw-r--r--interface-definitions/include/accel-ppp/client-ipv6-pool.xml.i (renamed from interface-definitions/include/accel-client-ipv6-pool.xml.i)4
-rw-r--r--interface-definitions/include/accel-ppp/gateway-address.xml.i (renamed from interface-definitions/include/accel-gateway-address.xml.i)4
-rw-r--r--interface-definitions/include/accel-ppp/lcp-echo-interval-failure.xml.i (renamed from interface-definitions/include/accel-lcp-echo-interval-failure.xml.i)4
-rw-r--r--interface-definitions/include/accel-ppp/lcp-echo-timeout.xml.i (renamed from interface-definitions/include/accel-lcp-echo-timeout.xml.i)4
-rw-r--r--interface-definitions/include/accel-ppp/mtu-128-16384.xml.i (renamed from interface-definitions/include/accel-mtu-128-16384.xml.i)4
-rw-r--r--interface-definitions/include/accel-ppp/name-server.xml.i (renamed from interface-definitions/include/accel-name-server.xml.i)4
-rw-r--r--interface-definitions/include/accel-ppp/ppp-mppe.xml.i (renamed from interface-definitions/include/accel-ppp-mppe.xml.i)4
-rw-r--r--interface-definitions/include/accel-ppp/radius-additions-disable-accounting.xml.i (renamed from interface-definitions/include/accel-radius-additions-disable-accounting.xml.i)4
-rw-r--r--interface-definitions/include/accel-ppp/radius-additions-rate-limit.xml.i (renamed from interface-definitions/include/accel-radius-additions-rate-limit.xml.i)4
-rw-r--r--interface-definitions/include/accel-ppp/radius-additions.xml.i (renamed from interface-definitions/include/accel-radius-additions.xml.i)6
-rw-r--r--interface-definitions/include/accel-ppp/wins-server.xml.i (renamed from interface-definitions/include/accel-wins-server.xml.i)4
-rw-r--r--interface-definitions/include/bfd-common.xml.i4
-rw-r--r--interface-definitions/include/bfd.xml.i8
-rw-r--r--interface-definitions/include/bgp-neighbor-afi-l2vpn-evpn.xml.i16
-rw-r--r--interface-definitions/include/bgp-route-map.xml.i10
-rw-r--r--interface-definitions/include/bgp/bgp-afi-aggregate-address.xml.i (renamed from interface-definitions/include/bgp-afi-aggregate-address.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-afi-allowas-in.xml.i (renamed from interface-definitions/include/bgp-afi-allowas-in.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-afi-attribute-unchanged.xml.i (renamed from interface-definitions/include/bgp-afi-attribute-unchanged.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-afi-capability-orf.xml.i (renamed from interface-definitions/include/bgp-afi-capability-orf.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-afi-common.xml.i (renamed from interface-definitions/include/bgp-afi-common.xml.i)20
-rw-r--r--interface-definitions/include/bgp/bgp-afi-ipv4-prefix-list.xml.i (renamed from interface-definitions/include/bgp-afi-ipv4-prefix-list.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-afi-ipv6-nexthop-local.xml.i (renamed from interface-definitions/include/bgp-afi-ipv6-nexthop-local.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-afi-ipv6-prefix-list.xml.i (renamed from interface-definitions/include/bgp-afi-ipv6-prefix-list.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-afi-l2vpn-common.xml.i (renamed from interface-definitions/include/bgp-afi-l2vpn-common.xml.i)6
-rw-r--r--interface-definitions/include/bgp/bgp-afi-maximum-paths.xml.i (renamed from interface-definitions/include/bgp-afi-maximum-paths.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-afi-nexthop-self.xml.i (renamed from interface-definitions/include/bgp-afi-nexthop-self.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-afi-redistribute-metric-route-map.xml.i (renamed from interface-definitions/include/bgp-afi-redistribute-metric-route-map.xml.i)6
-rw-r--r--interface-definitions/include/bgp/bgp-afi-route-map.xml.i (renamed from interface-definitions/include/bgp-afi-route-map.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-afi-route-reflector-client.xml.i (renamed from interface-definitions/include/bgp-afi-route-reflector-client.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-afi-route-server-client.xml.i (renamed from interface-definitions/include/bgp-afi-route-server-client.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-afi-soft-reconfiguration.xml.i (renamed from interface-definitions/include/bgp-afi-soft-reconfiguration.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-bfd.xml.i (renamed from interface-definitions/include/bgp-bfd.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-capability.xml.i (renamed from interface-definitions/include/bgp-capability.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-common-config.xml.i837
-rw-r--r--interface-definitions/include/bgp/bgp-description.xml.i (renamed from interface-definitions/include/bgp-description.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-disable-capability-negotiation.xml.i (renamed from interface-definitions/include/bgp-disable-capability-negotiation.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-disable-connected-check.xml.i (renamed from interface-definitions/include/bgp-disable-connected-check.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-ebgp-multihop.xml.i (renamed from interface-definitions/include/bgp-ebgp-multihop.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-local-as.xml.i (renamed from interface-definitions/include/bgp-local-as.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-neighbor-afi-ipv4-unicast.xml.i (renamed from interface-definitions/include/bgp-neighbor-afi-ipv4-unicast.xml.i)10
-rw-r--r--interface-definitions/include/bgp/bgp-neighbor-afi-ipv6-unicast.xml.i (renamed from interface-definitions/include/bgp-neighbor-afi-ipv6-unicast.xml.i)12
-rw-r--r--interface-definitions/include/bgp/bgp-neighbor-afi-l2vpn-evpn.xml.i16
-rw-r--r--interface-definitions/include/bgp/bgp-override-capability.xml.i (renamed from interface-definitions/include/bgp-override-capability.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-passive.xml.i (renamed from interface-definitions/include/bgp-passive.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-password.xml.i (renamed from interface-definitions/include/bgp-password.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-peer-group.xml.i (renamed from interface-definitions/include/bgp-peer-group.xml.i)7
-rw-r--r--interface-definitions/include/bgp/bgp-remote-as.xml.i (renamed from interface-definitions/include/bgp-remote-as.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-route-target.xml.i (renamed from interface-definitions/include/bgp-route-target.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-shutdown.xml.i (renamed from interface-definitions/include/bgp-shutdown.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-timers-holdtime.xml.i (renamed from interface-definitions/include/bgp-timers-holdtime.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-timers-keepalive.xml.i (renamed from interface-definitions/include/bgp-timers-keepalive.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-ttl-security.xml.i (renamed from interface-definitions/include/bgp-ttl-security.xml.i)4
-rw-r--r--interface-definitions/include/bgp/bgp-update-source.xml.i (renamed from interface-definitions/include/bgp-update-source.xml.i)4
-rw-r--r--interface-definitions/include/certificate-ca.xml.i4
-rw-r--r--interface-definitions/include/certificate-key.xml.i4
-rw-r--r--interface-definitions/include/certificate.xml.i4
-rw-r--r--interface-definitions/include/dhcp-server-domain-search.xml.i4
-rw-r--r--interface-definitions/include/generic-disable-node.xml.i4
-rw-r--r--interface-definitions/include/interface-ipv4-options.xml.i18
-rw-r--r--interface-definitions/include/interface-ipv6-options.xml.i12
-rw-r--r--interface-definitions/include/interface/address-ipv4-ipv6-dhcp.xml.i (renamed from interface-definitions/include/address-ipv4-ipv6-dhcp.xml.i)4
-rw-r--r--interface-definitions/include/interface/address-ipv4-ipv6.xml.i (renamed from interface-definitions/include/address-ipv4-ipv6.xml.i)4
-rw-r--r--interface-definitions/include/interface/dhcp-options.xml.i (renamed from interface-definitions/include/dhcp-options.xml.i)4
-rw-r--r--interface-definitions/include/interface/dhcpv6-options.xml.i (renamed from interface-definitions/include/dhcpv6-options.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-arp-cache-timeout.xml.i (renamed from interface-definitions/include/interface-arp-cache-timeout.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-description.xml.i (renamed from interface-definitions/include/interface-description.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-dial-on-demand.xml.i (renamed from interface-definitions/include/interface-dial-on-demand.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-disable-arp-filter.xml.i (renamed from interface-definitions/include/interface-disable-arp-filter.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-disable-forwarding.xml.i (renamed from interface-definitions/include/interface-disable-forwarding.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-disable-link-detect.xml.i (renamed from interface-definitions/include/interface-disable-link-detect.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-disable.xml.i (renamed from interface-definitions/include/interface-disable.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-eapol.xml.i (renamed from interface-definitions/include/interface-eapol.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-enable-arp-accept.xml.i (renamed from interface-definitions/include/interface-enable-arp-accept.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-enable-arp-announce.xml.i (renamed from interface-definitions/include/interface-enable-arp-announce.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-enable-arp-ignore.xml.i (renamed from interface-definitions/include/interface-enable-arp-ignore.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-enable-proxy-arp.xml.i (renamed from interface-definitions/include/interface-enable-proxy-arp.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-hw-id.xml.i (renamed from interface-definitions/include/interface-hw-id.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-ipv4-options.xml.i18
-rw-r--r--interface-definitions/include/interface/interface-ipv6-options.xml.i12
-rw-r--r--interface-definitions/include/interface/interface-mac.xml.i (renamed from interface-definitions/include/interface-mac.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-mirror.xml.i (renamed from interface-definitions/include/interface-mirror.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-mtu-1200-16000.xml.i (renamed from interface-definitions/include/interface-mtu-1200-16000.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-mtu-1450-16000.xml.i (renamed from interface-definitions/include/interface-mtu-1450-16000.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-mtu-64-8024.xml.i (renamed from interface-definitions/include/interface-mtu-64-8024.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-mtu-68-1500.xml.i (renamed from interface-definitions/include/interface-mtu-68-1500.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-mtu-68-16000.xml.i (renamed from interface-definitions/include/interface-mtu-68-16000.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-parameters-dont-fragment.xml.i (renamed from interface-definitions/include/interface-parameters-dont-fragment.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-parameters-flowlabel.xml.i (renamed from interface-definitions/include/interface-parameters-flowlabel.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-parameters-key.xml.i (renamed from interface-definitions/include/interface-parameters-key.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-parameters-tos.xml.i (renamed from interface-definitions/include/interface-parameters-tos.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-parameters-ttl.xml.i (renamed from interface-definitions/include/interface-parameters-ttl.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-proxy-arp-pvlan.xml.i (renamed from interface-definitions/include/interface-proxy-arp-pvlan.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-source-validation.xml.i (renamed from interface-definitions/include/interface-source-validation.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-vrf.xml.i (renamed from interface-definitions/include/interface-vrf.xml.i)4
-rw-r--r--interface-definitions/include/interface/interface-xdp.xml.i (renamed from interface-definitions/include/interface-xdp.xml.i)4
-rw-r--r--interface-definitions/include/interface/ipv6-address-autoconf.xml.i (renamed from interface-definitions/include/ipv6-address-autoconf.xml.i)4
-rw-r--r--interface-definitions/include/interface/ipv6-address-eui64.xml.i16
-rw-r--r--interface-definitions/include/interface/ipv6-address-no-default-link-local.xml.i (renamed from interface-definitions/include/ipv6-address-no-default-link-local.xml.i)4
-rw-r--r--interface-definitions/include/interface/ipv6-address.xml.i12
-rw-r--r--interface-definitions/include/interface/ipv6-disable-forwarding.xml.i (renamed from interface-definitions/include/ipv6-disable-forwarding.xml.i)4
-rw-r--r--interface-definitions/include/interface/ipv6-dup-addr-detect-transmits.xml.i (renamed from interface-definitions/include/ipv6-dup-addr-detect-transmits.xml.i)4
-rw-r--r--interface-definitions/include/interface/tunnel-remote.xml.i (renamed from interface-definitions/include/tunnel-remote.xml.i)4
-rw-r--r--interface-definitions/include/interface/vif-s.xml.i (renamed from interface-definitions/include/vif-s.xml.i)48
-rw-r--r--interface-definitions/include/interface/vif.xml.i (renamed from interface-definitions/include/vif.xml.i)26
-rw-r--r--interface-definitions/include/ipv6-address-eui64.xml.i15
-rw-r--r--interface-definitions/include/ipv6-address.xml.i12
-rw-r--r--interface-definitions/include/isis/isis-common-config.xml.i755
-rw-r--r--interface-definitions/include/isis/isis-redistribute-ipv4.xml.i (renamed from interface-definitions/include/isis-redistribute-ipv4.xml.i)4
-rw-r--r--interface-definitions/include/isis/passive.xml.i8
-rw-r--r--interface-definitions/include/listen-address-ipv4.xml.i4
-rw-r--r--interface-definitions/include/listen-address.xml.i4
-rw-r--r--interface-definitions/include/nat-address.xml.i4
-rw-r--r--interface-definitions/include/nat-interface.xml.i4
-rw-r--r--interface-definitions/include/nat-port.xml.i4
-rw-r--r--interface-definitions/include/nat-rule.xml.i4
-rw-r--r--interface-definitions/include/nat-translation-port.xml.i4
-rw-r--r--interface-definitions/include/ospf/ospf-authentication.xml.i (renamed from interface-definitions/include/ospf-authentication.xml.i)4
-rw-r--r--interface-definitions/include/ospf/ospf-common-config.xml.i761
-rw-r--r--interface-definitions/include/ospf/ospf-distance-global.xml.i14
-rw-r--r--interface-definitions/include/ospf/ospf-distance-per-protocol.xml.i38
-rw-r--r--interface-definitions/include/ospf/ospf-interface-common.xml.i (renamed from interface-definitions/include/ospf-interface-common.xml.i)11
-rw-r--r--interface-definitions/include/ospf/ospf-intervals.xml.i (renamed from interface-definitions/include/ospf-intervals.xml.i)4
-rw-r--r--interface-definitions/include/ospf/ospf-metric-type.xml.i (renamed from interface-definitions/include/ospf-metric-type.xml.i)4
-rw-r--r--interface-definitions/include/ospf/ospf-metric.xml.i (renamed from interface-definitions/include/ospf-metric.xml.i)4
-rw-r--r--interface-definitions/include/ospf/ospf-router-id.xml.i14
-rw-r--r--interface-definitions/include/policy-list-action.xml.i21
-rw-r--r--interface-definitions/include/policy-list-description.xml.i11
-rw-r--r--interface-definitions/include/policy-list-rule-description.xml.i11
-rw-r--r--interface-definitions/include/port-number.xml.i4
-rw-r--r--interface-definitions/include/radius-server-ipv4-ipv6.xml.i4
-rw-r--r--interface-definitions/include/radius-server-ipv4.xml.i4
-rw-r--r--interface-definitions/include/radius-server-key.xml.i4
-rw-r--r--interface-definitions/include/radius-server-port.xml.i4
-rw-r--r--interface-definitions/include/rip/rip-access-list.xml.i (renamed from interface-definitions/include/rip-access-list.xml.i)4
-rw-r--r--interface-definitions/include/rip/rip-access-list6.xml.i (renamed from interface-definitions/include/rip-access-list6.xml.i)4
-rw-r--r--interface-definitions/include/rip/rip-default-information.xml.i (renamed from interface-definitions/include/rip-default-information.xml.i)4
-rw-r--r--interface-definitions/include/rip/rip-default-metric.xml.i (renamed from interface-definitions/include/rip-default-metric.xml.i)4
-rw-r--r--interface-definitions/include/rip/rip-interface.xml.i (renamed from interface-definitions/include/rip-interface.xml.i)4
-rw-r--r--interface-definitions/include/rip/rip-prefix-list.xml.i (renamed from interface-definitions/include/rip-prefix-list.xml.i)4
-rw-r--r--interface-definitions/include/rip/rip-prefix-list6.xml.i (renamed from interface-definitions/include/rip-prefix-list6.xml.i)4
-rw-r--r--interface-definitions/include/rip/rip-redistribute.xml.i (renamed from interface-definitions/include/rip-redistribute.xml.i)6
-rw-r--r--interface-definitions/include/rip/rip-timers.xml.i (renamed from interface-definitions/include/rip-timers.xml.i)4
-rw-r--r--interface-definitions/include/route-map.xml.i (renamed from interface-definitions/include/ospf-route-map.xml.i)4
-rw-r--r--interface-definitions/include/source-address-ipv4-ipv6.xml.i4
-rw-r--r--interface-definitions/include/source-address-ipv4.xml.i4
-rw-r--r--interface-definitions/include/source-interface-ethernet.xml.i4
-rw-r--r--interface-definitions/include/source-interface.xml.i4
-rw-r--r--interface-definitions/include/static/static-route-blackhole.xml.i (renamed from interface-definitions/include/static-route-blackhole.xml.i)6
-rw-r--r--interface-definitions/include/static/static-route-distance.xml.i (renamed from interface-definitions/include/static-route-distance.xml.i)4
-rw-r--r--interface-definitions/include/static/static-route-interface.xml.i (renamed from interface-definitions/include/static-route-interface.xml.i)4
-rw-r--r--interface-definitions/include/static/static-route-map.xml.i (renamed from interface-definitions/include/static-route-map.xml.i)4
-rw-r--r--interface-definitions/include/static/static-route-vrf.xml.i (renamed from interface-definitions/include/static-route-vrf.xml.i)4
-rw-r--r--interface-definitions/include/static/static-route.xml.i (renamed from interface-definitions/include/static-route.xml.i)16
-rw-r--r--interface-definitions/include/static/static-route6.xml.i (renamed from interface-definitions/include/static-route6.xml.i)16
-rw-r--r--interface-definitions/include/vpn-ipsec-encryption.xml.i4
-rw-r--r--interface-definitions/include/vpn-ipsec-hash.xml.i4
-rw-r--r--interface-definitions/include/webproxy-url-filtering.xml.i4
-rw-r--r--interface-definitions/interfaces-bonding.xml.in30
-rw-r--r--interface-definitions/interfaces-bridge.xml.in32
-rw-r--r--interface-definitions/interfaces-dummy.xml.in10
-rw-r--r--interface-definitions/interfaces-erspan.xml.in16
-rw-r--r--interface-definitions/interfaces-ethernet.xml.in34
-rw-r--r--interface-definitions/interfaces-geneve.xml.in24
-rw-r--r--interface-definitions/interfaces-l2tpv3.xml.in16
-rw-r--r--interface-definitions/interfaces-loopback.xml.in6
-rw-r--r--interface-definitions/interfaces-macsec.xml.in14
-rw-r--r--interface-definitions/interfaces-openvpn.xml.in8
-rw-r--r--interface-definitions/interfaces-pppoe.xml.in16
-rw-r--r--interface-definitions/interfaces-pseudo-ethernet.xml.in26
-rw-r--r--interface-definitions/interfaces-tunnel.xml.in38
-rw-r--r--interface-definitions/interfaces-vxlan.xml.in24
-rw-r--r--interface-definitions/interfaces-wireguard.xml.in14
-rw-r--r--interface-definitions/interfaces-wireless.xml.in26
-rw-r--r--interface-definitions/interfaces-wirelessmodem.xml.in16
-rw-r--r--interface-definitions/ntp.xml.in2
-rw-r--r--interface-definitions/policy-lists.xml.in1266
-rw-r--r--interface-definitions/protocols-bgp.xml.in836
-rw-r--r--interface-definitions/protocols-isis.xml.in774
-rw-r--r--interface-definitions/protocols-ospf.xml.in818
-rw-r--r--interface-definitions/protocols-ospfv3.xml.in86
-rw-r--r--interface-definitions/protocols-rip.xml.in31
-rw-r--r--interface-definitions/protocols-ripng.xml.in29
-rw-r--r--interface-definitions/protocols-static.xml.in11
-rw-r--r--interface-definitions/protocols-vrf.xml.in35
-rw-r--r--interface-definitions/service_console-server.xml.in2
-rw-r--r--interface-definitions/service_ipoe-server.xml.in6
-rw-r--r--interface-definitions/service_pppoe-server.xml.in30
-rw-r--r--interface-definitions/snmp.xml.in2
-rw-r--r--interface-definitions/ssh.xml.in2
-rw-r--r--interface-definitions/system-login.xml.in2
-rw-r--r--interface-definitions/vpn_l2tp.xml.in24
-rw-r--r--interface-definitions/vpn_openconnect.xml.in2
-rw-r--r--interface-definitions/vpn_pptp.xml.in12
-rw-r--r--interface-definitions/vpn_sstp.xml.in26
-rw-r--r--interface-definitions/vrf.xml.in56
-rw-r--r--op-mode-definitions/include/bgp-common.xml.i170
-rw-r--r--op-mode-definitions/include/isis-common.xml.i179
-rw-r--r--op-mode-definitions/include/ospf-common.xml.i559
-rw-r--r--op-mode-definitions/nat.xml.in10
-rw-r--r--op-mode-definitions/nat66.xml.in98
-rw-r--r--op-mode-definitions/show-ip-bgp.xml.in169
-rw-r--r--op-mode-definitions/show-ip-ospf.xml.in559
-rw-r--r--op-mode-definitions/show-isis.xml.in178
-rw-r--r--op-mode-definitions/show-ntp.xml.in9
-rw-r--r--op-mode-definitions/show-version.xml.in2
-rw-r--r--op-mode-definitions/show-zebra.xml.in54
-rw-r--r--python/vyos/configquery.py90
-rw-r--r--python/vyos/configverify.py2
-rw-r--r--python/vyos/frr.py26
-rw-r--r--python/vyos/ifconfig/bridge.py6
-rw-r--r--python/vyos/ifconfig/interface.py43
-rw-r--r--python/vyos/util.py30
-rwxr-xr-xscripts/override-default9
-rw-r--r--smoketest/configs/bgp-evpn-leaf148
-rw-r--r--smoketest/configs/bgp-evpn-spine128
-rw-r--r--smoketest/configs/isis-small105
-rw-r--r--smoketest/configs/vrf-bgp166
-rw-r--r--smoketest/configs/vrf-ospf145
-rw-r--r--smoketest/scripts/cli/base_accel_ppp_test.py30
-rw-r--r--smoketest/scripts/cli/base_interfaces_test.py173
-rw-r--r--smoketest/scripts/cli/base_vyostest_shim.py90
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_bonding.py13
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_bridge.py101
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_dummy.py4
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_erspan.py85
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_ethernet.py50
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_geneve.py18
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_l2tpv3.py4
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_loopback.py13
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_macsec.py88
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_openvpn.py354
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_pppoe.py60
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_pseudo_ethernet.py4
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_tunnel.py127
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_vxlan.py18
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_wireguard.py52
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_wireless.py58
-rwxr-xr-xsmoketest/scripts/cli/test_interfaces_wirelessmodem.py27
-rwxr-xr-xsmoketest/scripts/cli/test_nat.py74
-rwxr-xr-xsmoketest/scripts/cli/test_nat66.py67
-rwxr-xr-xsmoketest/scripts/cli/test_policy.py143
-rwxr-xr-xsmoketest/scripts/cli/test_policy_local-route.py61
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_bfd.py97
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_bgp.py288
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_igmp-proxy.py41
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_isis.py102
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_ospf.py207
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_ospfv3.py88
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_rip.py97
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_ripng.py89
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_rpki.py51
-rwxr-xr-xsmoketest/scripts/cli/test_protocols_static.py137
-rwxr-xr-xsmoketest/scripts/cli/test_service_bcast-relay.py36
-rwxr-xr-xsmoketest/scripts/cli/test_service_dhcp-relay.py35
-rwxr-xr-xsmoketest/scripts/cli/test_service_dhcp-server.py155
-rwxr-xr-xsmoketest/scripts/cli/test_service_dhcpv6-relay.py31
-rwxr-xr-xsmoketest/scripts/cli/test_service_dhcpv6-server.py69
-rwxr-xr-xsmoketest/scripts/cli/test_service_dns_dynamic.py88
-rwxr-xr-xsmoketest/scripts/cli/test_service_dns_forwarding.py62
-rwxr-xr-xsmoketest/scripts/cli/test_service_https.py23
-rwxr-xr-xsmoketest/scripts/cli/test_service_mdns-repeater.py27
-rwxr-xr-xsmoketest/scripts/cli/test_service_pppoe-server.py14
-rwxr-xr-xsmoketest/scripts/cli/test_service_router-advert.py27
-rwxr-xr-xsmoketest/scripts/cli/test_service_snmp.py76
-rwxr-xr-xsmoketest/scripts/cli/test_service_ssh.py50
-rwxr-xr-xsmoketest/scripts/cli/test_service_tftp-server.py33
-rwxr-xr-xsmoketest/scripts/cli/test_service_webproxy.py97
-rwxr-xr-xsmoketest/scripts/cli/test_system_acceleration_qat.py27
-rwxr-xr-xsmoketest/scripts/cli/test_system_ip.py26
-rwxr-xr-xsmoketest/scripts/cli/test_system_ipv6.py32
-rwxr-xr-xsmoketest/scripts/cli/test_system_lcd.py19
-rwxr-xr-xsmoketest/scripts/cli/test_system_login.py55
-rwxr-xr-xsmoketest/scripts/cli/test_system_nameserver.py30
-rwxr-xr-xsmoketest/scripts/cli/test_system_ntp.py29
-rwxr-xr-xsmoketest/scripts/cli/test_vpn_openconnect.py32
-rwxr-xr-xsmoketest/scripts/cli/test_vpn_sstp.py6
-rwxr-xr-xsmoketest/scripts/cli/test_vrf.py48
-rwxr-xr-xsmoketest/scripts/system/test_iproute2.py31
-rwxr-xr-xsrc/completion/list_bgp_peer_groups.sh23
-rwxr-xr-xsrc/conf_mode/dynamic_dns.py2
-rwxr-xr-xsrc/conf_mode/http-api.py12
-rwxr-xr-xsrc/conf_mode/interfaces-tunnel.py4
-rwxr-xr-xsrc/conf_mode/nat66.py9
-rwxr-xr-xsrc/conf_mode/policy-lists.py117
-rwxr-xr-xsrc/conf_mode/protocols_bgp.py233
-rwxr-xr-xsrc/conf_mode/protocols_isis.py249
-rwxr-xr-xsrc/conf_mode/protocols_ospf.py69
-rwxr-xr-xsrc/conf_mode/protocols_ospfv3.py3
-rwxr-xr-xsrc/conf_mode/protocols_rip.py3
-rwxr-xr-xsrc/conf_mode/protocols_ripng.py8
-rwxr-xr-xsrc/conf_mode/protocols_static.py47
-rwxr-xr-xsrc/conf_mode/protocols_vrf.py72
-rwxr-xr-xsrc/conf_mode/service_console-server.py32
-rwxr-xr-xsrc/conf_mode/vrf.py38
-rw-r--r--src/etc/udev/rules.d/99-vyos-wwan.rules11
-rwxr-xr-xsrc/migration-scripts/bgp/0-to-160
-rwxr-xr-xsrc/migration-scripts/isis/0-to-159
-rwxr-xr-xsrc/migration-scripts/vrf/1-to-261
-rwxr-xr-xsrc/op_mode/ppp-server-ctrl.py5
-rwxr-xr-xsrc/op_mode/show_ipsec_sa.py3
-rwxr-xr-xsrc/op_mode/show_nat66_rules.py80
-rwxr-xr-xsrc/op_mode/show_nat66_statistics.py63
-rwxr-xr-xsrc/op_mode/show_nat66_translations.py204
-rwxr-xr-xsrc/op_mode/show_nat_rules.py75
-rwxr-xr-xsrc/op_mode/show_nat_statistics.py2
-rwxr-xr-xsrc/op_mode/show_ntp.sh39
-rwxr-xr-xsrc/services/vyos-configd62
-rwxr-xr-xsrc/services/vyos-http-api-server571
-rw-r--r--src/shim/vyshim.c36
-rw-r--r--src/systemd/vyos-http-api.service3
-rw-r--r--src/tests/test_dict_search.py10
-rwxr-xr-xsrc/validators/interface-name19
-rwxr-xr-xsrc/validators/ipv6-eui64-prefix16
329 files changed, 10390 insertions, 6759 deletions
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 7ac48ee4c..8458d3208 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -8,6 +8,81 @@ review this contribution guideline.
The following paragraphs are an excerpt from our Documentation.
+## Submit a Patch
+
+Patches are always more than welcome. To have a clean and easy to maintain
+repository we have some guidelines when working with Git. A clean repository
+eases the automatic generation of a changelog file.
+
+A good approach for writing commit messages is actually to have a look at the
+file(s) history by invoking git log path/to/file.txt.
+
+### Prepare patch/commit
+
+In a big system, such as VyOS, that is comprised of multiple components, it’s
+impossible to keep track of all the changes and bugs/feature requests in one’s
+head. We use a bugtracker known as Phabricator for it (“issue tracker” would
+be a better term, but this one stuck).
+
+The information is used in three ways:
+
+* Keep track of the progress (what we have already done in this branch and
+ what we still need to do).
+* Prepare automatic release notes for upcoming releases
+* Help future maintainers of VyOS (it could be you!) to find out why certain
+ things have been changed in the codebase or why certain features have been
+ added
+
+To make this approach work, every change must be associated with a task number
+(prefixed with **T**) and a component. If there is no bug report/feature
+request for the changes you are going to make, you have to create a Phabricator
+task first. Once there is an entry in Phabricator, you should reference its id
+in your commit message, as shown below:
+
+* `ddclient: T1030: auto create runtime directories`
+* `Jenkins: add current Git commit ID to build description`
+
+If there is no [Phabricator](https://phabricator.vyos.net) reference in the
+commits of your pull request, we have to ask you to amend the commit message.
+Otherwise we will have to reject it.
+
+## Writing good commit messages
+
+The format should be and is inspired by this very good and detailed
+[Git documentation](https://git-scm.com/book/ch5-2.html), it is also worth
+reading https://chris.beams.io/posts/git-commit/.
+
+This is nothing VyOS specific - it is more a general topic for distributed
+development environments.
+
+* A single, short, summary of the commit (recommended 50 characters or less,
+ not exceeding 80 characters) containing a prefix of the changed component
+ and the corresponding Phabricator reference e.g. `snmp: T1111:` or
+ `ethernet: T2222:` - multiple components could be concatenated as in `snmp:
+ ethernet: T3333`
+* In some contexts, the first line is treated as the subject of an email and
+ the rest of the text as the body. The blank line separating the summary from
+ the body is critical (unless you omit the body entirely); tools like rebase
+ can get confused if you run the two together.
+* Followed by a message which describes all the details like:
+ * What/why/how something has been changed, makes everyone’s life easier when
+ working with `git bisect`
+ * All text of the commit message should be wrapped at 72 characters if
+ possible which makes reading commit logs easier with git log on a standard
+ terminal (which happens to be 80x25)
+ * If applicable a reference to a previous commit should be made linking those
+ commits nicely when browsing the history: `After commit abcd12ef ("snmp:
+ this is a headline") a Python import statement is missing, throwing the
+ following exception: ABCDEF`
+* Always use the `-x` option to the `git cherry-pick` command when back or
+ forward porting an individual commit. This automatically appends the line:
+ `(cherry picked from commit <ID>)` to the original authors commit message
+ making it easier when bisecting problems.
+* Every change set must be consistent (self containing)! Do not fix multiple
+ bugs in a single commit. If you already worked on multiple fixes in the same
+ file use git add –patch to only add the parts related to the one issue into
+ your upcoming commit.
+
## Bug Report/Issue
Issues or bugs are found in any software project. VyOS is not an exception.
diff --git a/Makefile b/Makefile
index 2adf385f9..2d3a14f4e 100644
--- a/Makefile
+++ b/Makefile
@@ -45,6 +45,7 @@ interface_definitions: $(config_xml_obj)
rm -f $(TMPL_DIR)/vpn/node.def
rm -f $(TMPL_DIR)/vpn/ipsec/node.def
rm -rf $(TMPL_DIR)/vpn/nipsec
+ rm -rf $(TMPL_DIR)/npolicy
.PHONY: op_mode_definitions
.ONESHELL:
diff --git a/data/configd-include.json b/data/configd-include.json
index aabd7232e..eed858363 100644
--- a/data/configd-include.json
+++ b/data/configd-include.json
@@ -44,7 +44,6 @@
"protocols_ripng.py",
"protocols_static.py",
"protocols_static_multicast.py",
-"protocols_vrf.py",
"salt-minion.py",
"service_console-server.py",
"service_ids_fastnetmon.py",
diff --git a/data/templates/firewall/nftables-nat66.tmpl b/data/templates/firewall/nftables-nat66.tmpl
index cdaeaad6a..e5c1b1b8d 100644
--- a/data/templates/firewall/nftables-nat66.tmpl
+++ b/data/templates/firewall/nftables-nat66.tmpl
@@ -1,9 +1,13 @@
#!/usr/sbin/nft -f
{% macro nptv6_rule(rule,config, chain) %}
-{% set src_prefix = "ip6 saddr " + config.source.prefix if config.source is defined and config.source.prefix is defined and config.source.prefix is not none %}
-{% set dest_address = "ip6 daddr " + config.destination.address if config.destination is defined and config.destination.address is defined and config.destination.address is not none %}
+{% set comment = '' %}
+{% set base_log = '' %}
+{% set src_prefix = "ip6 saddr " + config.source.prefix if config.source is defined and config.source.prefix is defined and config.source.prefix is not none %}
+{% set dest_address = "ip6 daddr " + config.destination.address if config.destination is defined and config.destination.address is defined and config.destination.address is not none %}
{% if chain == "PREROUTING" %}
+{% set comment = "DST-NAT66-" + rule %}
+{% set base_log = '[NAT66-DST-' + rule %}
{% set interface = " iifname \"" + config.inbound_interface + "\"" if config.inbound_interface is defined and config.inbound_interface != 'any' else '' %}
{% if config.translation.address | is_ip_network %}
{# support 1:1 network translation #}
@@ -13,6 +17,8 @@
{% endif %}
{% set trns_address = dnat_type + config.translation.address if config.translation is defined and config.translation.address is defined and config.translation.address is not none %}
{% elif chain == "POSTROUTING" %}
+{% set comment = 'SRC-NAT66-' + rule %}
+{% set base_log = '[NAT66-SRC-' + rule %}
{% if config.translation is defined and config.translation.address is defined and config.translation.address is not none %}
{% if config.translation.address == 'masquerade' %}
{% set trns_address = config.translation.address %}
@@ -28,10 +34,12 @@
{% endif %}
{% set interface = " oifname \"" + config.outbound_interface + "\"" if config.outbound_interface is defined else '' %}
{% endif %}
-{% set comment = "NPT-NAT-" + rule %}
-{% if rule.log %}
-{% set base_log = "[NPT-DST-" + rule %}
-{% set log = base_log + "]" %}
+{% if config.log is defined %}
+{% if config.translation is defined and config.translation.address is defined and config.translation.address == 'masquerade' %}
+{% set log = base_log +'-MASQ]' %}
+{% else %}
+{% set log = base_log + "]" %}
+{% endif %}
{% endif %}
{% set output = "add rule ip6 nat " + chain + interface %}
{# Count packets #}
diff --git a/data/templates/frr/bgp.frr.tmpl b/data/templates/frr/bgp.frr.tmpl
index f7aeaeb9d..53e62928b 100644
--- a/data/templates/frr/bgp.frr.tmpl
+++ b/data/templates/frr/bgp.frr.tmpl
@@ -185,7 +185,7 @@
{% endif %}
{% endmacro %}
!
-router bgp {{ asn }}
+router bgp {{ local_as }} {{ 'vrf ' + vrf if vrf is defined and vrf is not none }}
{% if parameters is defined and parameters.ebgp_requires_policy is defined %}
bgp ebgp-requires-policy
{% else %}
diff --git a/data/templates/frr/isis.frr.tmpl b/data/templates/frr/isis.frr.tmpl
index 4460ab3b5..7f996b134 100644
--- a/data/templates/frr/isis.frr.tmpl
+++ b/data/templates/frr/isis.frr.tmpl
@@ -1,5 +1,5 @@
!
-router isis {{ process }}
+router isis VyOS {{ 'vrf ' + vrf if vrf is defined and vrf is not none }}
net {{ net }}
{% if dynamic_hostname is defined %}
hostname dynamic
@@ -133,8 +133,8 @@ router isis {{ process }}
!
{% if interface is defined and interface is not none %}
{% for iface, iface_config in interface.items() %}
-interface {{ iface }}
- ip router isis {{ process }}
+interface {{ iface }} {{ 'vrf ' + vrf if vrf is defined and vrf is not none }}
+ ip router isis VyOS
{% if iface_config.bfd is defined %}
isis bfd
{% endif %}
diff --git a/data/templates/frr/ospf.frr.tmpl b/data/templates/frr/ospf.frr.tmpl
index 140b6b406..a47c64c89 100644
--- a/data/templates/frr/ospf.frr.tmpl
+++ b/data/templates/frr/ospf.frr.tmpl
@@ -1,7 +1,7 @@
!
{% if interface is defined and interface is not none %}
{% for iface, iface_config in interface.items() %}
-interface {{ iface }}
+interface {{ iface }} {{ 'vrf ' + vrf if vrf is defined and vrf is not none }}
{% if iface_config.authentication is defined and iface_config.authentication is not none %}
{% if iface_config.authentication.plaintext_password is defined and iface_config.authentication.plaintext_password is not none %}
ip ospf authentication-key {{ iface_config.authentication.plaintext_password }}
@@ -50,7 +50,7 @@ interface {{ iface }}
{% endfor %}
{% endif %}
!
-router ospf
+router ospf {{ 'vrf ' + vrf if vrf is defined and vrf is not none }}
{% if access_list is defined and access_list is not none %}
{% for acl, acl_config in access_list.items() %}
{% for protocol in acl_config.export if acl_config.export is defined %}
diff --git a/data/templates/frr/static.frr.tmpl b/data/templates/frr/static.frr.tmpl
index bb0ec80a5..db59a44c2 100644
--- a/data/templates/frr/static.frr.tmpl
+++ b/data/templates/frr/static.frr.tmpl
@@ -1,18 +1,29 @@
{% from 'frr/static_routes_macro.j2' import static_routes %}
!
+{% set ip_prefix = 'ip' %}
+{% set ipv6_prefix = 'ipv6' %}
+{% if vrf is defined and vrf is not none %}
+{# We need to add an additional whitespace in front of the prefix #}
+{# when VRFs are in use, thus we use a variable for prefix handling #}
+{% set ip_prefix = ' ip' %}
+{% set ipv6_prefix = ' ipv6' %}
+vrf {{ vrf }}
+{% endif %}
{# IPv4 routing #}
{% if route is defined and route is not none %}
{% for prefix, prefix_config in route.items() %}
-{{ static_routes('ip', prefix, prefix_config) }}
+{{ static_routes(ip_prefix, prefix, prefix_config) }}
{%- endfor -%}
{% endif %}
-!
{# IPv6 routing #}
{% if route6 is defined and route6 is not none %}
{% for prefix, prefix_config in route6.items() %}
-{{ static_routes('ipv6', prefix, prefix_config) }}
+{{ static_routes(ipv6_prefix, prefix, prefix_config) }}
{%- endfor -%}
{% endif %}
+{% if vrf is defined and vrf is not none %}
+ exit-vrf
+{% endif %}
!
{# Policy route tables #}
{% if table is defined and table is not none %}
diff --git a/data/templates/frr/vrf.frr.tmpl b/data/templates/frr/vrf.frr.tmpl
deleted file mode 100644
index 8d3d8e9dd..000000000
--- a/data/templates/frr/vrf.frr.tmpl
+++ /dev/null
@@ -1,25 +0,0 @@
-{% from 'frr/static_routes_macro.j2' import static_routes %}
-!
-{% if vrf is defined and vrf is not none %}
-{% for vrf_name, vrf_config in vrf.items() %}
-vrf {{ vrf_name }}
-{% if vrf_config.vni is defined and vrf_config.vni is not none %}
- vni {{ vrf_config.vni }}
-{% endif %}
-{% if vrf_config.static is defined and vrf_config.static is not none %}
-{# IPv4 routes #}
-{% if vrf_config.static.route is defined and vrf_config.static.route is not none %}
-{% for prefix, prefix_config in vrf_config.static.route.items() %}
- {{ static_routes('ip', prefix, prefix_config) }}
-{%- endfor -%}
-{% endif %}
-{# IPv6 routes #}
-{% if vrf_config.static.route6 is defined and vrf_config.static.route6 is not none %}
-{% for prefix, prefix_config in vrf_config.static.route6.items() %}
- {{ static_routes('ipv6', prefix, prefix_config) }}
-{%- endfor -%}
-{% endif %}
-{% endif %}
-{% endfor %}
-{% endif %}
-!
diff --git a/data/templates/https/nginx.default.tmpl b/data/templates/https/nginx.default.tmpl
index 81f8b3b8c..916764410 100644
--- a/data/templates/https/nginx.default.tmpl
+++ b/data/templates/https/nginx.default.tmpl
@@ -40,9 +40,11 @@ server {
{% endif %}
# proxy settings for HTTP API, if enabled; 503, if not
- location ~ /(retrieve|configure|config-file|image|generate|show) {
+ location ~ /(retrieve|configure|config-file|image|generate|show|docs|openapi.json|redoc) {
{% if server.api %}
proxy_pass http://localhost:{{ server.api.port }};
+ proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
+ proxy_set_header X-Forwarded-Proto $scheme;
proxy_read_timeout 600;
proxy_buffering off;
{% else %}
diff --git a/debian/control b/debian/control
index cf9835b07..24e43d4c8 100644
--- a/debian/control
+++ b/debian/control
@@ -19,7 +19,6 @@ Build-Depends:
python3-netifaces,
python3-nose,
python3-jinja2,
- python3-paramiko,
python3-psutil,
python3-setuptools,
python3-sphinx,
@@ -98,6 +97,7 @@ Depends:
python3-jmespath,
python3-netaddr,
python3-netifaces,
+ python3-paramiko,
python3-psutil,
python3-pystache,
python3-pyudev,
@@ -126,6 +126,7 @@ Depends:
udp-broadcast-relay,
usb-modeswitch,
usbutils,
+ vyos-http-api-tools,
vyos-utils,
wide-dhcpv6-client,
wireguard-tools,
diff --git a/interface-definitions/include/accel-auth-local-users.xml.i b/interface-definitions/include/accel-ppp/auth-local-users.xml.i
index 35c7a2a06..308d6510d 100644
--- a/interface-definitions/include/accel-auth-local-users.xml.i
+++ b/interface-definitions/include/accel-ppp/auth-local-users.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from accel-auth-local-users.xml.i -->
+<!-- include start from accel-ppp/auth-local-users.xml.i -->
<node name="local-users">
<properties>
<help>Local user authentication for PPPoE server</help>
@@ -48,4 +48,4 @@
</tagNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/accel-auth-mode.xml.i b/interface-definitions/include/accel-ppp/auth-mode.xml.i
index 85c3c5e82..c1a87cfe3 100644
--- a/interface-definitions/include/accel-auth-mode.xml.i
+++ b/interface-definitions/include/accel-ppp/auth-mode.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from accel-auth-mode.xml.i -->
+<!-- include start from accel-ppp/auth-mode.xml.i -->
<leafNode name="mode">
<properties>
<help>Authentication mode used by this server</help>
@@ -19,4 +19,4 @@
</properties>
<defaultValue>local</defaultValue>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/accel-auth-protocols.xml.i b/interface-definitions/include/accel-ppp/auth-protocols.xml.i
index a6899a4d8..d43266152 100644
--- a/interface-definitions/include/accel-auth-protocols.xml.i
+++ b/interface-definitions/include/accel-ppp/auth-protocols.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from accel-auth-protocols.xml.i -->
+<!-- include start from accel-ppp/auth-protocols.xml.i -->
<leafNode name="protocols">
<properties>
<help>Authentication protocol for remote access peer SSTP VPN</help>
@@ -28,4 +28,4 @@
</properties>
<defaultValue>pap chap mschap mschap-v2</defaultValue>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/accel-client-ip-pool-start-stop.xml.i b/interface-definitions/include/accel-ppp/client-ip-pool-start-stop.xml.i
index b578f2b2c..5f4132d13 100644
--- a/interface-definitions/include/accel-client-ip-pool-start-stop.xml.i
+++ b/interface-definitions/include/accel-ppp/client-ip-pool-start-stop.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from accel-client-ip-pool-start-stop.xml.i -->
+<!-- include start from accel-ppp/client-ip-pool-start-stop.xml.i -->
<leafNode name="start">
<properties>
<help>First IP address in the pool</help>
@@ -15,4 +15,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/accel-client-ip-pool-subnet.xml.i b/interface-definitions/include/accel-ppp/client-ip-pool-subnet.xml.i
index 8e9ca0e92..2dc71d3f9 100644
--- a/interface-definitions/include/accel-client-ip-pool-subnet.xml.i
+++ b/interface-definitions/include/accel-ppp/client-ip-pool-subnet.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from accel-client-ip-pool-subnet.xml.i -->
+<!-- include start from accel-ppp/client-ip-pool-subnet.xml.i -->
<leafNode name="subnet">
<properties>
<help>Client IP subnet (CIDR notation)</help>
@@ -13,4 +13,4 @@
<multi />
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/accel-client-ipv6-pool.xml.i b/interface-definitions/include/accel-ppp/client-ipv6-pool.xml.i
index d15ff35d4..bd3dadf8d 100644
--- a/interface-definitions/include/accel-client-ipv6-pool.xml.i
+++ b/interface-definitions/include/accel-ppp/client-ipv6-pool.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from accel-client-ipv6-pool.xml.i -->
+<!-- include start from accel-ppp/client-ipv6-pool.xml.i -->
<node name="client-ipv6-pool">
<properties>
<help>Pool of client IPv6 addresses</help>
@@ -58,4 +58,4 @@
</tagNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/accel-gateway-address.xml.i b/interface-definitions/include/accel-ppp/gateway-address.xml.i
index c45c8b532..59f8b5023 100644
--- a/interface-definitions/include/accel-gateway-address.xml.i
+++ b/interface-definitions/include/accel-ppp/gateway-address.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from accel-gateway-address.xml.i -->
+<!-- include start from accel-ppp/gateway-address.xml.i -->
<leafNode name="gateway-address">
<properties>
<help>Gateway IP address</help>
@@ -12,4 +12,4 @@
</valueHelp>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/accel-lcp-echo-interval-failure.xml.i b/interface-definitions/include/accel-ppp/lcp-echo-interval-failure.xml.i
index cccf4b4f2..dd7ae1276 100644
--- a/interface-definitions/include/accel-lcp-echo-interval-failure.xml.i
+++ b/interface-definitions/include/accel-ppp/lcp-echo-interval-failure.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from accel-lcp-echo-interval-failure.xml.i -->
+<!-- include start from accel-ppp/lcp-echo-interval-failure.xml.i -->
<leafNode name="lcp-echo-interval">
<properties>
<help>LCP echo-requests/sec</help>
@@ -17,4 +17,4 @@
</properties>
<defaultValue>3</defaultValue>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/accel-lcp-echo-timeout.xml.i b/interface-definitions/include/accel-ppp/lcp-echo-timeout.xml.i
index 888fa9d41..a630bec32 100644
--- a/interface-definitions/include/accel-lcp-echo-timeout.xml.i
+++ b/interface-definitions/include/accel-ppp/lcp-echo-timeout.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from accel-lcp-echo-timeout.xml.i -->
+<!-- include start from accel-ppp/lcp-echo-timeout.xml.i -->
<leafNode name="lcp-echo-timeout">
<properties>
<help>Timeout in seconds to wait for any peer activity. If this option specified it turns on adaptive lcp echo functionality and "lcp-echo-failure" is not used.</help>
@@ -8,4 +8,4 @@
</properties>
<defaultValue>0</defaultValue>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/accel-mtu-128-16384.xml.i b/interface-definitions/include/accel-ppp/mtu-128-16384.xml.i
index 6bd089823..b4008a63b 100644
--- a/interface-definitions/include/accel-mtu-128-16384.xml.i
+++ b/interface-definitions/include/accel-ppp/mtu-128-16384.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from accel-mtu-128-16384.xml.i -->
+<!-- include start from accel-ppp/mtu-128-16384.xml.i -->
<leafNode name="mtu">
<properties>
<help>Maximum Transmission Unit (MTU) - default 1492</help>
@@ -8,4 +8,4 @@
</properties>
<defaultValue>1492</defaultValue>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/accel-name-server.xml.i b/interface-definitions/include/accel-ppp/name-server.xml.i
index e46c75b52..e744b384f 100644
--- a/interface-definitions/include/accel-name-server.xml.i
+++ b/interface-definitions/include/accel-ppp/name-server.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from accel-name-server.xml.i -->
+<!-- include start from accel-ppp/name-server.xml.i -->
<leafNode name="name-server">
<properties>
<help>Domain Name Server (DNS) propagated to client</help>
@@ -17,4 +17,4 @@
<multi/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/accel-ppp-mppe.xml.i b/interface-definitions/include/accel-ppp/ppp-mppe.xml.i
index b7f9cfd92..e8370180b 100644
--- a/interface-definitions/include/accel-ppp-mppe.xml.i
+++ b/interface-definitions/include/accel-ppp/ppp-mppe.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from accel-ppp-mppe.xml.i -->
+<!-- include start from accel-ppp/ppp-mppe.xml.i -->
<leafNode name="mppe">
<properties>
<help>Specifies mppe negotiation preferences</help>
@@ -23,4 +23,4 @@
</properties>
<defaultValue>prefer</defaultValue>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/accel-radius-additions-disable-accounting.xml.i b/interface-definitions/include/accel-ppp/radius-additions-disable-accounting.xml.i
index dc5b9dd96..c723c3174 100644
--- a/interface-definitions/include/accel-radius-additions-disable-accounting.xml.i
+++ b/interface-definitions/include/accel-ppp/radius-additions-disable-accounting.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from accel-radius-additions-disable-accounting.xml.i -->
+<!-- include start from accel-ppp/radius-additions-disable-accounting.xml.i -->
<leafNode name="disable-accounting">
<properties>
<help>Disable accounting</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/accel-radius-additions-rate-limit.xml.i b/interface-definitions/include/accel-ppp/radius-additions-rate-limit.xml.i
index 23a4a51cf..be49fce5a 100644
--- a/interface-definitions/include/accel-radius-additions-rate-limit.xml.i
+++ b/interface-definitions/include/accel-ppp/radius-additions-rate-limit.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from accel-radius-additions-rate-limit.xml.i -->
+<!-- include start from accel-ppp/radius-additions-rate-limit.xml.i -->
<node name="rate-limit">
<properties>
<help>Upload/Download speed limits</help>
@@ -23,4 +23,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/accel-radius-additions.xml.i b/interface-definitions/include/accel-ppp/radius-additions.xml.i
index 0067b6d1c..e65088c43 100644
--- a/interface-definitions/include/accel-radius-additions.xml.i
+++ b/interface-definitions/include/accel-ppp/radius-additions.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from accel-radius-additions.xml.i -->
+<!-- include start from accel-ppp/radius-additions.xml.i -->
<node name="radius">
<children>
<leafNode name="acct-interim-jitter">
@@ -29,7 +29,7 @@
</properties>
<defaultValue>1813</defaultValue>
</leafNode>
- #include <include/accel-radius-additions-disable-accounting.xml.i>
+ #include <include/accel-ppp/radius-additions-disable-accounting.xml.i>
<leafNode name="fail-time">
<properties>
<help>Mark server unavailable for &lt;n&gt; seconds on failure</help>
@@ -150,4 +150,4 @@
</node>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/accel-wins-server.xml.i b/interface-definitions/include/accel-ppp/wins-server.xml.i
index 6de032981..f7f483f59 100644
--- a/interface-definitions/include/accel-wins-server.xml.i
+++ b/interface-definitions/include/accel-ppp/wins-server.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from accel-wins-server.xml.i -->
+<!-- include start from accel-ppp/wins-server.xml.i -->
<leafNode name="wins-server">
<properties>
<help>Windows Internet Name Service (WINS) servers propagated to client</help>
@@ -12,4 +12,4 @@
<multi/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bfd-common.xml.i b/interface-definitions/include/bfd-common.xml.i
index ff73e4b20..b47b47612 100644
--- a/interface-definitions/include/bfd-common.xml.i
+++ b/interface-definitions/include/bfd-common.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bfd-common.xml.i -->
+<!-- include start from bfd-common.xml.i -->
<leafNode name="echo-mode">
<properties>
<help>Enables the echo transmission mode</help>
@@ -69,4 +69,4 @@
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bfd.xml.i b/interface-definitions/include/bfd.xml.i
new file mode 100644
index 000000000..2bc3664e1
--- /dev/null
+++ b/interface-definitions/include/bfd.xml.i
@@ -0,0 +1,8 @@
+<!-- include start from bfd.xml.i -->
+<leafNode name="bfd">
+ <properties>
+ <help>Enable Bidirectional Forwarding Detection (BFD)</help>
+ <valueless/>
+ </properties>
+</leafNode>
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-neighbor-afi-l2vpn-evpn.xml.i b/interface-definitions/include/bgp-neighbor-afi-l2vpn-evpn.xml.i
deleted file mode 100644
index df346afc1..000000000
--- a/interface-definitions/include/bgp-neighbor-afi-l2vpn-evpn.xml.i
+++ /dev/null
@@ -1,16 +0,0 @@
-<!-- included start from bgp-neighbor-afi-l2vpn-evpn.xml.i -->
-<node name="l2vpn-evpn">
- <properties>
- <help>L2VPN EVPN BGP settings</help>
- </properties>
- <children>
- #include <include/bgp-afi-allowas-in.xml.i>
- #include <include/bgp-afi-attribute-unchanged.xml.i>
- #include <include/bgp-afi-nexthop-self.xml.i>
- #include <include/bgp-afi-route-map.xml.i>
- #include <include/bgp-afi-route-reflector-client.xml.i>
- #include <include/bgp-afi-route-server-client.xml.i>
- #include <include/bgp-afi-soft-reconfiguration.xml.i>
- </children>
-</node>
-<!-- included end -->
diff --git a/interface-definitions/include/bgp-route-map.xml.i b/interface-definitions/include/bgp-route-map.xml.i
deleted file mode 100644
index 18b092354..000000000
--- a/interface-definitions/include/bgp-route-map.xml.i
+++ /dev/null
@@ -1,10 +0,0 @@
-<!-- included start from bgp-route-map.xml.i -->
-<leafNode name="route-map">
- <properties>
- <help>Route-map to modify route attributes</help>
- <completionHelp>
- <path>policy route-map</path>
- </completionHelp>
- </properties>
-</leafNode>
-<!-- included end -->
diff --git a/interface-definitions/include/bgp-afi-aggregate-address.xml.i b/interface-definitions/include/bgp/bgp-afi-aggregate-address.xml.i
index c33d1097c..c731e970b 100644
--- a/interface-definitions/include/bgp-afi-aggregate-address.xml.i
+++ b/interface-definitions/include/bgp/bgp-afi-aggregate-address.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-afi-aggregate-address.xml.i -->
+<!-- include start from bgp-afi-aggregate-address.xml.i -->
<leafNode name="as-set">
<properties>
<help>Generate AS-set path information for this aggregate address</help>
@@ -11,4 +11,4 @@
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-afi-allowas-in.xml.i b/interface-definitions/include/bgp/bgp-afi-allowas-in.xml.i
index 77de04ed7..738bf0211 100644
--- a/interface-definitions/include/bgp-afi-allowas-in.xml.i
+++ b/interface-definitions/include/bgp/bgp-afi-allowas-in.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-afi-allowas-in.xml.i -->
+<!-- include start from bgp-afi-allowas-in.xml.i -->
<node name="allowas-in">
<properties>
<help>Accept route that contains the local-as in the as-path</help>
@@ -18,4 +18,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-afi-attribute-unchanged.xml.i b/interface-definitions/include/bgp/bgp-afi-attribute-unchanged.xml.i
index fef53dd9d..f407c3f74 100644
--- a/interface-definitions/include/bgp-afi-attribute-unchanged.xml.i
+++ b/interface-definitions/include/bgp/bgp-afi-attribute-unchanged.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-afi-attribute-unchanged.xml.i -->
+<!-- include start from bgp-afi-attribute-unchanged.xml.i -->
<node name="attribute-unchanged">
<properties>
<help>BGP attributes are sent unchanged</help>
@@ -24,4 +24,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-afi-capability-orf.xml.i b/interface-definitions/include/bgp/bgp-afi-capability-orf.xml.i
index 9bd265f93..dd5c5f8b2 100644
--- a/interface-definitions/include/bgp-afi-capability-orf.xml.i
+++ b/interface-definitions/include/bgp/bgp-afi-capability-orf.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-afi-capability-orf.xml.i -->
+<!-- include start from bgp-afi-capability-orf.xml.i -->
<node name="orf">
<properties>
<help>Advertise ORF capability to this peer</help>
@@ -25,4 +25,4 @@
</node>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-afi-common.xml.i b/interface-definitions/include/bgp/bgp-afi-common.xml.i
index 90c2753c8..7782e7ef2 100644
--- a/interface-definitions/include/bgp-afi-common.xml.i
+++ b/interface-definitions/include/bgp/bgp-afi-common.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-afi-common.xml.i -->
+<!-- include start from bgp-afi-common.xml.i -->
<leafNode name="addpath-tx-all">
<properties>
<help>Use addpath to advertise all paths to a neighbor</help>
@@ -11,14 +11,14 @@
<valueless/>
</properties>
</leafNode>
-#include <include/bgp-afi-allowas-in.xml.i>
+#include <include/bgp/bgp-afi-allowas-in.xml.i>
<leafNode name="as-override">
<properties>
<help>AS for routes sent to this peer to be the local AS</help>
<valueless/>
</properties>
</leafNode>
-#include <include/bgp-afi-attribute-unchanged.xml.i>
+#include <include/bgp/bgp-afi-attribute-unchanged.xml.i>
<node name="disable-send-community">
<properties>
<help>Disable sending community attributes to this peer</help>
@@ -43,7 +43,7 @@
<help>Originate default route to this peer</help>
</properties>
<children>
- #include <include/bgp-route-map.xml.i>
+ #include <include/route-map.xml.i>
</children>
</node>
<node name="distribute-list">
@@ -118,17 +118,17 @@
</constraint>
</properties>
</leafNode>
-#include <include/bgp-afi-nexthop-self.xml.i>
+#include <include/bgp/bgp-afi-nexthop-self.xml.i>
<leafNode name="remove-private-as">
<properties>
<help>Remove private AS numbers from AS path in outbound route updates</help>
<valueless/>
</properties>
</leafNode>
-#include <include/bgp-afi-route-map.xml.i>
-#include <include/bgp-afi-route-reflector-client.xml.i>
-#include <include/bgp-afi-route-server-client.xml.i>
-#include <include/bgp-afi-soft-reconfiguration.xml.i>
+#include <include/bgp/bgp-afi-route-map.xml.i>
+#include <include/bgp/bgp-afi-route-reflector-client.xml.i>
+#include <include/bgp/bgp-afi-route-server-client.xml.i>
+#include <include/bgp/bgp-afi-soft-reconfiguration.xml.i>
<leafNode name="unsuppress-map">
<properties>
<help>Route-map to selectively unsuppress suppressed routes</help>
@@ -149,4 +149,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-afi-ipv4-prefix-list.xml.i b/interface-definitions/include/bgp/bgp-afi-ipv4-prefix-list.xml.i
index bbbada6bd..133b5da28 100644
--- a/interface-definitions/include/bgp-afi-ipv4-prefix-list.xml.i
+++ b/interface-definitions/include/bgp/bgp-afi-ipv4-prefix-list.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-afi-ipv4-prefix-list.xml.i -->
+<!-- include start from bgp-afi-ipv4-prefix-list.xml.i -->
<node name="prefix-list">
<properties>
<help>IPv4-Prefix-list to filter route updates to/from this peer</help>
@@ -22,4 +22,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-afi-ipv6-nexthop-local.xml.i b/interface-definitions/include/bgp/bgp-afi-ipv6-nexthop-local.xml.i
index 4778b392f..c74d81b1f 100644
--- a/interface-definitions/include/bgp-afi-ipv6-nexthop-local.xml.i
+++ b/interface-definitions/include/bgp/bgp-afi-ipv6-nexthop-local.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-afi-ipv6-nexthop-local.xml.i -->
+<!-- include start from bgp-afi-ipv6-nexthop-local.xml.i -->
<node name="nexthop-local">
<properties>
<help>Nexthop attributes</help>
@@ -12,4 +12,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-afi-ipv6-prefix-list.xml.i b/interface-definitions/include/bgp/bgp-afi-ipv6-prefix-list.xml.i
index 8ae7837e9..d597b7c99 100644
--- a/interface-definitions/include/bgp-afi-ipv6-prefix-list.xml.i
+++ b/interface-definitions/include/bgp/bgp-afi-ipv6-prefix-list.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-afi-ipv6-prefix-list.xml.i -->
+<!-- include start from bgp-afi-ipv6-prefix-list.xml.i -->
<node name="prefix-list">
<properties>
<help>Prefix-list to filter route updates to/from this peer</help>
@@ -22,4 +22,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-afi-l2vpn-common.xml.i b/interface-definitions/include/bgp/bgp-afi-l2vpn-common.xml.i
index 2bbf57532..3e7e4ef78 100644
--- a/interface-definitions/include/bgp-afi-l2vpn-common.xml.i
+++ b/interface-definitions/include/bgp/bgp-afi-l2vpn-common.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-afi-l2vpn-common.xml.i -->
+<!-- include start from bgp-afi-l2vpn-common.xml.i -->
<leafNode name="advertise-default-gw">
<properties>
<help>Advertise All default g/w mac-ip routes in EVPN</help>
@@ -23,5 +23,5 @@
</constraint>
</properties>
</leafNode>
-#include <include/bgp-route-target.xml.i>
-<!-- included end -->
+#include <include/bgp/bgp-route-target.xml.i>
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-afi-maximum-paths.xml.i b/interface-definitions/include/bgp/bgp-afi-maximum-paths.xml.i
index 62133c375..6b220caa5 100644
--- a/interface-definitions/include/bgp-afi-maximum-paths.xml.i
+++ b/interface-definitions/include/bgp/bgp-afi-maximum-paths.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-afi-maximum-paths.xml.i -->
+<!-- include start from bgp-afi-maximum-paths.xml.i -->
<node name="maximum-paths">
<properties>
<help>Forward packets over multiple paths</help>
@@ -30,4 +30,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-afi-nexthop-self.xml.i b/interface-definitions/include/bgp/bgp-afi-nexthop-self.xml.i
index 0bcc4e937..a299f561e 100644
--- a/interface-definitions/include/bgp-afi-nexthop-self.xml.i
+++ b/interface-definitions/include/bgp/bgp-afi-nexthop-self.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-afi-nexthop-self.xml.i -->
+<!-- include start from bgp-afi-nexthop-self.xml.i -->
<node name="nexthop-self">
<properties>
<help>Disable the next hop calculation for this peer</help>
@@ -12,4 +12,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-afi-redistribute-metric-route-map.xml.i b/interface-definitions/include/bgp/bgp-afi-redistribute-metric-route-map.xml.i
index e85bf7d11..4382901c8 100644
--- a/interface-definitions/include/bgp-afi-redistribute-metric-route-map.xml.i
+++ b/interface-definitions/include/bgp/bgp-afi-redistribute-metric-route-map.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-afi-redistribute-metric-route-map.xml.i -->
+<!-- include start from bgp-afi-redistribute-metric-route-map.xml.i -->
<leafNode name="metric">
<properties>
<help>Metric for redistributed routes</help>
@@ -8,5 +8,5 @@
</valueHelp>
</properties>
</leafNode>
-#include <include/bgp-route-map.xml.i>
-<!-- included end -->
+#include <include/route-map.xml.i>
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-afi-route-map.xml.i b/interface-definitions/include/bgp/bgp-afi-route-map.xml.i
index 5549f56ca..7fac98586 100644
--- a/interface-definitions/include/bgp-afi-route-map.xml.i
+++ b/interface-definitions/include/bgp/bgp-afi-route-map.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-afi-route-map.xml.i -->
+<!-- include start from bgp-afi-route-map.xml.i -->
<node name="route-map">
<properties>
<help>Route-map to filter route updates to/from this peer</help>
@@ -22,4 +22,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-afi-route-reflector-client.xml.i b/interface-definitions/include/bgp/bgp-afi-route-reflector-client.xml.i
index f6a9caa61..70fee40f0 100644
--- a/interface-definitions/include/bgp-afi-route-reflector-client.xml.i
+++ b/interface-definitions/include/bgp/bgp-afi-route-reflector-client.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from bgp-afi-route-reflector-client.xml.i -->
+<!-- include start from bgp-afi-route-reflector-client.xml.i -->
<leafNode name="route-reflector-client">
<properties>
<help>Peer is a route reflector client</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-afi-route-server-client.xml.i b/interface-definitions/include/bgp/bgp-afi-route-server-client.xml.i
index 60de553fe..29719c463 100644
--- a/interface-definitions/include/bgp-afi-route-server-client.xml.i
+++ b/interface-definitions/include/bgp/bgp-afi-route-server-client.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from bgp-afi-route-server-client.xml.i -->
+<!-- include start from bgp-afi-route-server-client.xml.i -->
<leafNode name="route-server-client">
<properties>
<help>Peer is a route server client</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end --> \ No newline at end of file
+<!-- include end --> \ No newline at end of file
diff --git a/interface-definitions/include/bgp-afi-soft-reconfiguration.xml.i b/interface-definitions/include/bgp/bgp-afi-soft-reconfiguration.xml.i
index 7af11f8f4..c3f050bb8 100644
--- a/interface-definitions/include/bgp-afi-soft-reconfiguration.xml.i
+++ b/interface-definitions/include/bgp/bgp-afi-soft-reconfiguration.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-afi-soft-reconfiguration.xml.i -->
+<!-- include start from bgp-afi-soft-reconfiguration.xml.i -->
<node name="soft-reconfiguration">
<properties>
<help>Soft reconfiguration for peer</help>
@@ -12,4 +12,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-bfd.xml.i b/interface-definitions/include/bgp/bgp-bfd.xml.i
index fe52b12f2..d918fd673 100644
--- a/interface-definitions/include/bgp-bfd.xml.i
+++ b/interface-definitions/include/bgp/bgp-bfd.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-bfd.xml.i -->
+<!-- include start from bgp-bfd.xml.i -->
<node name="bfd">
<properties>
<help>Enable Bidirectional Forwarding Detection (BFD) support</help>
@@ -12,4 +12,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-capability.xml.i b/interface-definitions/include/bgp/bgp-capability.xml.i
index 8de5bd8ab..89ce19ca6 100644
--- a/interface-definitions/include/bgp-capability.xml.i
+++ b/interface-definitions/include/bgp/bgp-capability.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-capability.xml.i -->
+<!-- include start from bgp-capability.xml.i -->
<node name="capability">
<properties>
<help>Advertise capabilities to this peer-group</help>
@@ -18,4 +18,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp/bgp-common-config.xml.i b/interface-definitions/include/bgp/bgp-common-config.xml.i
new file mode 100644
index 000000000..c89e2288e
--- /dev/null
+++ b/interface-definitions/include/bgp/bgp-common-config.xml.i
@@ -0,0 +1,837 @@
+<!-- include start from bgp/bgp-common-config.xml.i -->
+<node name="address-family">
+ <properties>
+ <help>BGP address-family parameters</help>
+ </properties>
+ <children>
+ <node name="ipv4-unicast">
+ <properties>
+ <help>IPv4 BGP settings</help>
+ </properties>
+ <children>
+ <tagNode name="aggregate-address">
+ <properties>
+ <help>BGP aggregate network</help>
+ <valueHelp>
+ <format>ipv4net</format>
+ <description>BGP aggregate network</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-prefix"/>
+ </constraint>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-afi-aggregate-address.xml.i>
+ </children>
+ </tagNode>
+ <tagNode name="network">
+ <properties>
+ <help>BGP network</help>
+ <valueHelp>
+ <format>ipv4net</format>
+ <description>BGP network</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-prefix"/>
+ </constraint>
+ </properties>
+ <children>
+ <leafNode name="backdoor">
+ <properties>
+ <help>Network as a backdoor route</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ #include <include/route-map.xml.i>
+ </children>
+ </tagNode>
+ #include <include/bgp/bgp-afi-maximum-paths.xml.i>
+ <node name="redistribute">
+ <properties>
+ <help>Redistribute routes from other protocols into BGP</help>
+ </properties>
+ <children>
+ <node name="connected">
+ <properties>
+ <help>Redistribute connected routes into BGP</help>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-afi-redistribute-metric-route-map.xml.i>
+ </children>
+ </node>
+ <node name="isis">
+ <properties>
+ <help>Redistribute IS-IS routes into BGP</help>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-afi-redistribute-metric-route-map.xml.i>
+ </children>
+ </node>
+ <node name="kernel">
+ <properties>
+ <help>Redistribute kernel routes into BGP</help>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-afi-redistribute-metric-route-map.xml.i>
+ </children>
+ </node>
+ <node name="ospf">
+ <properties>
+ <help>Redistribute OSPF routes into BGP</help>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-afi-redistribute-metric-route-map.xml.i>
+ </children>
+ </node>
+ <node name="rip">
+ <properties>
+ <help>Redistribute RIP routes into BGP</help>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-afi-redistribute-metric-route-map.xml.i>
+ </children>
+ </node>
+ <node name="static">
+ <properties>
+ <help>Redistribute static routes into BGP</help>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-afi-redistribute-metric-route-map.xml.i>
+ </children>
+ </node>
+ <leafNode name="table">
+ <properties>
+ <help>Redistribute non-main Kernel Routing Table</help>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ </children>
+ </node>
+ <node name="ipv6-unicast">
+ <properties>
+ <help>IPv6 BGP settings</help>
+ </properties>
+ <children>
+ <tagNode name="aggregate-address">
+ <properties>
+ <help>BGP aggregate network</help>
+ <valueHelp>
+ <format>ipv6net</format>
+ <description>Aggregate network</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv6-prefix"/>
+ </constraint>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-afi-aggregate-address.xml.i>
+ </children>
+ </tagNode>
+ <tagNode name="network">
+ <properties>
+ <help>BGP network</help>
+ <valueHelp>
+ <format>ipv6net</format>
+ <description>Aggregate network</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv6-prefix"/>
+ </constraint>
+ </properties>
+ <children>
+ <leafNode name="path-limit">
+ <properties>
+ <help>AS-path hopcount limit</help>
+ <valueHelp>
+ <format>u32:0-255</format>
+ <description>AS path hop count limit</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-255"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ #include <include/route-map.xml.i>
+ </children>
+ </tagNode>
+ #include <include/bgp/bgp-afi-maximum-paths.xml.i>
+ <node name="redistribute">
+ <properties>
+ <help>Redistribute routes from other protocols into BGP</help>
+ </properties>
+ <children>
+ <node name="connected">
+ <properties>
+ <help>Redistribute connected routes into BGP</help>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-afi-redistribute-metric-route-map.xml.i>
+ </children>
+ </node>
+ <node name="kernel">
+ <properties>
+ <help>Redistribute kernel routes into BGP</help>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-afi-redistribute-metric-route-map.xml.i>
+ </children>
+ </node>
+ <node name="ospfv3">
+ <properties>
+ <help>Redistribute OSPFv3 routes into BGP</help>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-afi-redistribute-metric-route-map.xml.i>
+ </children>
+ </node>
+ <node name="ripng">
+ <properties>
+ <help>Redistribute RIPng routes into BGP</help>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-afi-redistribute-metric-route-map.xml.i>
+ </children>
+ </node>
+ <node name="static">
+ <properties>
+ <help>Redistribute static routes into BGP</help>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-afi-redistribute-metric-route-map.xml.i>
+ </children>
+ </node>
+ <leafNode name="table">
+ <properties>
+ <help>Redistribute non-main Kernel Routing Table</help>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ </children>
+ </node>
+ <node name="l2vpn-evpn">
+ <properties>
+ <help>L2VPN EVPN BGP settings</help>
+ </properties>
+ <children>
+ <leafNode name="advertise-all-vni">
+ <properties>
+ <help>Advertise All local VNIs</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ #include <include/bgp/bgp-afi-l2vpn-common.xml.i>
+ <leafNode name="advertise-pip">
+ <properties>
+ <help>EVPN system primary IP</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>IP address</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-address"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="rt-auto-derive">
+ <properties>
+ <help>Auto derivation of Route Target (RFC8365)</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <node name="flooding">
+ <properties>
+ <help>Specify handling for BUM packets</help>
+ </properties>
+ <children>
+ <leafNode name="disable">
+ <properties>
+ <help>Do not flood any BUM packets</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="head-end-replication">
+ <properties>
+ <help>Flood BUM packets using head-end replication</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <tagNode name="vni">
+ <properties>
+ <help>VXLAN Network Identifier</help>
+ <valueHelp>
+ <format>u32:1-16777215</format>
+ <description>VNI number</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-16777215"/>
+ </constraint>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-afi-l2vpn-common.xml.i>
+ </children>
+ </tagNode>
+ </children>
+ </node>
+ </children>
+</node>
+<node name="listen">
+ <properties>
+ <help>BGP dynamic neighbors listen commands</help>
+ </properties>
+ <children>
+ <leafNode name="limit">
+ <properties>
+ <help>Maximum number of dynamic neighbors that can be created</help>
+ <valueHelp>
+ <format>u32:1-5000</format>
+ <description>BGP neighbor limit</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-5000"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <tagNode name="range">
+ <properties>
+ <help>Dynamic neighbors listen range</help>
+ <valueHelp>
+ <format>ipv4net</format>
+ <description>IPv4 dynamic neighbors listen range</description>
+ </valueHelp>
+ <valueHelp>
+ <format>ipv6net</format>
+ <description>IPv6 dynamic neighbors listen range</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-prefix"/>
+ <validator name="ipv6-prefix"/>
+ </constraint>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-peer-group.xml.i>
+ </children>
+ </tagNode>
+ </children>
+</node>
+<leafNode name="local-as">
+ <properties>
+ <help>Autonomous System Number (ASN)</help>
+ <valueHelp>
+ <format>u32:1-4294967294</format>
+ <description>Autonomous System Number</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-4294967294"/>
+ </constraint>
+ </properties>
+</leafNode>
+<tagNode name="neighbor">
+ <properties>
+ <help>BGP neighbor</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>BGP neighbor IP address</description>
+ </valueHelp>
+ <valueHelp>
+ <format>ipv6</format>
+ <description>BGP neighbor IPv6 address</description>
+ </valueHelp>
+ <valueHelp>
+ <format>txt</format>
+ <description>Interface name</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-address"/>
+ <validator name="ipv6-address"/>
+ <validator name="interface-name"/>
+ </constraint>
+ </properties>
+ <children>
+ <node name="address-family">
+ <properties>
+ <help>Parameters relating to IPv4 or IPv6 routes</help>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-neighbor-afi-ipv4-unicast.xml.i>
+ #include <include/bgp/bgp-neighbor-afi-ipv6-unicast.xml.i>
+ #include <include/bgp/bgp-neighbor-afi-l2vpn-evpn.xml.i>
+ </children>
+ </node>
+ <leafNode name="advertisement-interval">
+ <properties>
+ <help>Minimum interval for sending routing updates</help>
+ <valueHelp>
+ <format>u32:0-600</format>
+ <description>Advertisement interval in seconds</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-600"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ #include <include/bgp/bgp-bfd.xml.i>
+ #include <include/bgp/bgp-capability.xml.i>
+ #include <include/bgp/bgp-description.xml.i>
+ #include <include/bgp/bgp-disable-capability-negotiation.xml.i>
+ #include <include/bgp/bgp-disable-connected-check.xml.i>
+ #include <include/bgp/bgp-ebgp-multihop.xml.i>
+ <node name="interface">
+ <properties>
+ <help>Interface parameters</help>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-peer-group.xml.i>
+ #include <include/bgp/bgp-remote-as.xml.i>
+ <node name="v6only">
+ <properties>
+ <help>Enable BGP with v6 link-local only</help>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-peer-group.xml.i>
+ #include <include/bgp/bgp-remote-as.xml.i>
+ </children>
+ </node>
+ </children>
+ </node>
+ #include <include/bgp/bgp-local-as.xml.i>
+ #include <include/bgp/bgp-override-capability.xml.i>
+ #include <include/bgp/bgp-passive.xml.i>
+ #include <include/bgp/bgp-password.xml.i>
+ #include <include/bgp/bgp-peer-group.xml.i>
+ <leafNode name="port">
+ <properties>
+ <help>Neighbor BGP port</help>
+ <valueHelp>
+ <format>u32:1-65535</format>
+ <description>Neighbor BGP port number</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-65535"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ #include <include/bgp/bgp-remote-as.xml.i>
+ #include <include/bgp/bgp-shutdown.xml.i>
+ <leafNode name="strict-capability-match">
+ <properties>
+ <help>Enable strict capability negotiation</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <node name="timers">
+ <properties>
+ <help>Neighbor timers</help>
+ </properties>
+ <children>
+ <leafNode name="connect">
+ <properties>
+ <help>BGP connect timer for this neighbor</help>
+ <valueHelp>
+ <format>u32:1-65535</format>
+ <description>Connect timer in seconds</description>
+ </valueHelp>
+ <valueHelp>
+ <format>0</format>
+ <description>Disable connect timer</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-65535"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ #include <include/bgp/bgp-timers-holdtime.xml.i>
+ #include <include/bgp/bgp-timers-keepalive.xml.i>
+ </children>
+ </node>
+ #include <include/bgp/bgp-ttl-security.xml.i>
+ #include <include/bgp/bgp-update-source.xml.i>
+ </children>
+</tagNode>
+<node name="parameters">
+ <properties>
+ <help>BGP parameters</help>
+ </properties>
+ <children>
+ <leafNode name="always-compare-med">
+ <properties>
+ <help>Always compare MEDs from different neighbors</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <node name="bestpath">
+ <properties>
+ <help>Default bestpath selection mechanism</help>
+ </properties>
+ <children>
+ <node name="as-path">
+ <properties>
+ <help>AS-path attribute comparison parameters</help>
+ </properties>
+ <children>
+ <leafNode name="confed">
+ <properties>
+ <help>Compare AS-path lengths including confederation sets and sequences</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="ignore">
+ <properties>
+ <help>Ignore AS-path length in selecting a route</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="multipath-relax">
+ <properties>
+ <help>Allow load sharing across routes that have different AS paths (but same length)</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <leafNode name="compare-routerid">
+ <properties>
+ <help>Compare the router-id for identical EBGP paths</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <node name="med">
+ <properties>
+ <help>MED attribute comparison parameters</help>
+ </properties>
+ <children>
+ <leafNode name="confed">
+ <properties>
+ <help>Compare MEDs among confederation paths</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="missing-as-worst">
+ <properties>
+ <help>Treat missing route as a MED as the least preferred one</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ </children>
+ </node>
+ <leafNode name="cluster-id">
+ <properties>
+ <help>Route-reflector cluster-id</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>Route-reflector cluster-id</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-address"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <node name="confederation">
+ <properties>
+ <help>AS confederation parameters</help>
+ </properties>
+ <children>
+ <leafNode name="identifier">
+ <properties>
+ <help>Confederation AS identifier [REQUIRED]</help>
+ <valueHelp>
+ <format>u32:1-4294967294</format>
+ <description>Confederation AS id</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-4294967294"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="peers">
+ <properties>
+ <help>Peer ASs in the BGP confederation</help>
+ <valueHelp>
+ <format>u32:1-4294967294</format>
+ <description>Peer AS number</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-4294967294"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <node name="dampening">
+ <properties>
+ <help>Enable route-flap dampening</help>
+ </properties>
+ <children>
+ <leafNode name="half-life">
+ <properties>
+ <help>Half-life time for dampening [REQUIRED]</help>
+ <valueHelp>
+ <format>u32:1-45</format>
+ <description>Half-life penalty in minutes</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-45"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="max-suppress-time">
+ <properties>
+ <help>Maximum duration to suppress a stable route [REQUIRED]</help>
+ <valueHelp>
+ <format>u32:1-255</format>
+ <description>Maximum suppress duration in minutes</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-255"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="re-use">
+ <properties>
+ <help>Threshold to start reusing a route [REQUIRED]</help>
+ <valueHelp>
+ <format>u32:1-20000</format>
+ <description>Re-use penalty points</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-20000"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="start-suppress-time">
+ <properties>
+ <help>When to start suppressing a route [REQUIRED]</help>
+ <valueHelp>
+ <format>u32:1-20000</format>
+ <description>Start-suppress penalty points</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-20000"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <node name="default">
+ <properties>
+ <help>BGP defaults</help>
+ </properties>
+ <children>
+ <leafNode name="local-pref">
+ <properties>
+ <help>Default local preference</help>
+ <valueHelp>
+ <format>u32</format>
+ <description>Local preference</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-4294967295"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="no-ipv4-unicast">
+ <properties>
+ <help>Deactivate IPv4 unicast for a peer by default</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <leafNode name="deterministic-med">
+ <properties>
+ <help>Compare MEDs between different peers in the same AS</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <node name="distance">
+ <properties>
+ <help>Administratives distances for BGP routes</help>
+ </properties>
+ <children>
+ <node name="global">
+ <properties>
+ <help>Global administratives distances for BGP routes</help>
+ </properties>
+ <children>
+ <leafNode name="external">
+ <properties>
+ <help>Administrative distance for external BGP routes</help>
+ <valueHelp>
+ <format>u32:1-255</format>
+ <description>Administrative distance for external BGP routes</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-255"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="internal">
+ <properties>
+ <help>Administrative distance for internal BGP routes</help>
+ <valueHelp>
+ <format>u32:1-255</format>
+ <description>Administrative distance for internal BGP routes</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-255"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="local">
+ <properties>
+ <help>Administrative distance for local BGP routes</help>
+ <valueHelp>
+ <format>u32:1-255</format>
+ <description>Administrative distance for internal BGP routes</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-255"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <tagNode name="prefix">
+ <properties>
+ <help>Administrative distance for a specific BGP prefix</help>
+ <valueHelp>
+ <format>ipv4net</format>
+ <description>Administrative distance for a specific BGP prefix</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-prefix"/>
+ </constraint>
+ </properties>
+ <children>
+ <leafNode name="distance">
+ <properties>
+ <help>Administrative distance for prefix</help>
+ <valueHelp>
+ <format>u32:1-255</format>
+ <description>Administrative distance for external BGP routes</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-255"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </tagNode>
+ </children>
+ </node>
+ <leafNode name="ebgp-requires-policy">
+ <properties>
+ <help>Require in and out policy for eBGP peers (RFC8212)</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <node name="graceful-restart">
+ <properties>
+ <help>Graceful restart capability parameters</help>
+ </properties>
+ <children>
+ <leafNode name="stalepath-time">
+ <properties>
+ <help>Maximum time to hold onto restarting neighbors stale paths</help>
+ <valueHelp>
+ <format>u32:1-3600</format>
+ <description>Hold time in seconds</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-3600"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <leafNode name="graceful-shutdown">
+ <properties>
+ <help>Graceful shutdown</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="log-neighbor-changes">
+ <properties>
+ <help>Log neighbor up/down changes and reset reason</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="network-import-check">
+ <properties>
+ <help>Enable IGP route check for network statements</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="no-client-to-client-reflection">
+ <properties>
+ <help>Disable client to client route reflection</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="no-fast-external-failover">
+ <properties>
+ <help>Disable immediate session reset on peer link down event</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="router-id">
+ <properties>
+ <help>BGP router id</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>BGP router id</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-address"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+</node>
+<tagNode name="peer-group">
+ <properties>
+ <help>BGP peer-group</help>
+ </properties>
+ <children>
+ <node name="address-family">
+ <properties>
+ <help>BGP peer-group address-family parameters</help>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-neighbor-afi-ipv4-unicast.xml.i>
+ #include <include/bgp/bgp-neighbor-afi-ipv6-unicast.xml.i>
+ #include <include/bgp/bgp-neighbor-afi-l2vpn-evpn.xml.i>
+ </children>
+ </node>
+ #include <include/bgp/bgp-bfd.xml.i>
+ #include <include/bgp/bgp-capability.xml.i>
+ #include <include/bgp/bgp-description.xml.i>
+ #include <include/bgp/bgp-disable-capability-negotiation.xml.i>
+ #include <include/bgp/bgp-disable-connected-check.xml.i>
+ #include <include/bgp/bgp-ebgp-multihop.xml.i>
+ #include <include/bgp/bgp-local-as.xml.i>
+ #include <include/bgp/bgp-override-capability.xml.i>
+ #include <include/bgp/bgp-passive.xml.i>
+ #include <include/bgp/bgp-password.xml.i>
+ #include <include/bgp/bgp-remote-as.xml.i>
+ #include <include/bgp/bgp-shutdown.xml.i>
+ #include <include/bgp/bgp-ttl-security.xml.i>
+ #include <include/bgp/bgp-update-source.xml.i>
+ </children>
+</tagNode>
+#include <include/route-map.xml.i>
+<node name="timers">
+ <properties>
+ <help>BGP protocol timers</help>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-timers-holdtime.xml.i>
+ #include <include/bgp/bgp-timers-keepalive.xml.i>
+ </children>
+</node>
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-description.xml.i b/interface-definitions/include/bgp/bgp-description.xml.i
index e1766cb9f..308bbec12 100644
--- a/interface-definitions/include/bgp-description.xml.i
+++ b/interface-definitions/include/bgp/bgp-description.xml.i
@@ -1,7 +1,7 @@
-<!-- included start from bgp-description.xml.i -->
+<!-- include start from bgp-description.xml.i -->
<leafNode name="description">
<properties>
<help>Neighbor specific description</help>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-disable-capability-negotiation.xml.i b/interface-definitions/include/bgp/bgp-disable-capability-negotiation.xml.i
index a43c6e8b9..74c3321d9 100644
--- a/interface-definitions/include/bgp-disable-capability-negotiation.xml.i
+++ b/interface-definitions/include/bgp/bgp-disable-capability-negotiation.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from bgp-disable-capability-negotiation.xml.i -->
+<!-- include start from bgp-disable-capability-negotiation.xml.i -->
<leafNode name="disable-capability-negotiation">
<properties>
<help>Disable capability negotiation with this neighbor</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-disable-connected-check.xml.i b/interface-definitions/include/bgp/bgp-disable-connected-check.xml.i
index bb9098bf6..15142b0ac 100644
--- a/interface-definitions/include/bgp-disable-connected-check.xml.i
+++ b/interface-definitions/include/bgp/bgp-disable-connected-check.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from bgp-disable-connected-check.xml.i -->
+<!-- include start from bgp-disable-connected-check.xml.i -->
<leafNode name="disable-connected-check">
<properties>
<help>Disable check to see if eBGP peer address is a connected route</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-ebgp-multihop.xml.i b/interface-definitions/include/bgp/bgp-ebgp-multihop.xml.i
index 6459fcf47..48580af3c 100644
--- a/interface-definitions/include/bgp-ebgp-multihop.xml.i
+++ b/interface-definitions/include/bgp/bgp-ebgp-multihop.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-ebgp-multihop.xml.i -->
+<!-- include start from bgp-ebgp-multihop.xml.i -->
<leafNode name="ebgp-multihop">
<properties>
<help>Allow this EBGP neighbor to not be on a directly connected network</help>
@@ -11,4 +11,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-local-as.xml.i b/interface-definitions/include/bgp/bgp-local-as.xml.i
index cf55ce476..7fc896a31 100644
--- a/interface-definitions/include/bgp-local-as.xml.i
+++ b/interface-definitions/include/bgp/bgp-local-as.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-local-as.xml.i -->
+<!-- include start from bgp-local-as.xml.i -->
<tagNode name="local-as">
<properties>
<help>Local AS number [REQUIRED]</help>
@@ -19,4 +19,4 @@
</leafNode>
</children>
</tagNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-neighbor-afi-ipv4-unicast.xml.i b/interface-definitions/include/bgp/bgp-neighbor-afi-ipv4-unicast.xml.i
index ece277fbf..945483276 100644
--- a/interface-definitions/include/bgp-neighbor-afi-ipv4-unicast.xml.i
+++ b/interface-definitions/include/bgp/bgp-neighbor-afi-ipv4-unicast.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-neighbor-afi-ipv4-unicast.xml.i -->
+<!-- include start from bgp-neighbor-afi-ipv4-unicast.xml.i -->
<node name="ipv4-unicast">
<properties>
<help>IPv4 BGP neighbor parameters</help>
@@ -9,11 +9,11 @@
<help>Advertise capabilities to this neighbor (IPv4)</help>
</properties>
<children>
- #include <include/bgp-afi-capability-orf.xml.i>
+ #include <include/bgp/bgp-afi-capability-orf.xml.i>
</children>
</node>
- #include <include/bgp-afi-ipv4-prefix-list.xml.i>
- #include <include/bgp-afi-common.xml.i>
+ #include <include/bgp/bgp-afi-ipv4-prefix-list.xml.i>
+ #include <include/bgp/bgp-afi-common.xml.i>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-neighbor-afi-ipv6-unicast.xml.i b/interface-definitions/include/bgp/bgp-neighbor-afi-ipv6-unicast.xml.i
index e43c34113..4cd676cb4 100644
--- a/interface-definitions/include/bgp-neighbor-afi-ipv6-unicast.xml.i
+++ b/interface-definitions/include/bgp/bgp-neighbor-afi-ipv6-unicast.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-neighbor-afi-ipv6-unicast.xml.i -->
+<!-- include start from bgp-neighbor-afi-ipv6-unicast.xml.i -->
<node name="ipv6-unicast">
<properties>
<help>IPv6 BGP neighbor parameters</help>
@@ -9,12 +9,12 @@
<help>Advertise capabilities to this neighbor (IPv6)</help>
</properties>
<children>
- #include <include/bgp-afi-capability-orf.xml.i>
+ #include <include/bgp/bgp-afi-capability-orf.xml.i>
</children>
</node>
- #include <include/bgp-afi-ipv6-nexthop-local.xml.i>
- #include <include/bgp-afi-ipv6-prefix-list.xml.i>
- #include <include/bgp-afi-common.xml.i>
+ #include <include/bgp/bgp-afi-ipv6-nexthop-local.xml.i>
+ #include <include/bgp/bgp-afi-ipv6-prefix-list.xml.i>
+ #include <include/bgp/bgp-afi-common.xml.i>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp/bgp-neighbor-afi-l2vpn-evpn.xml.i b/interface-definitions/include/bgp/bgp-neighbor-afi-l2vpn-evpn.xml.i
new file mode 100644
index 000000000..0a9c599fa
--- /dev/null
+++ b/interface-definitions/include/bgp/bgp-neighbor-afi-l2vpn-evpn.xml.i
@@ -0,0 +1,16 @@
+<!-- include start from bgp-neighbor-afi-l2vpn-evpn.xml.i -->
+<node name="l2vpn-evpn">
+ <properties>
+ <help>L2VPN EVPN BGP settings</help>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-afi-allowas-in.xml.i>
+ #include <include/bgp/bgp-afi-attribute-unchanged.xml.i>
+ #include <include/bgp/bgp-afi-nexthop-self.xml.i>
+ #include <include/bgp/bgp-afi-route-map.xml.i>
+ #include <include/bgp/bgp-afi-route-reflector-client.xml.i>
+ #include <include/bgp/bgp-afi-route-server-client.xml.i>
+ #include <include/bgp/bgp-afi-soft-reconfiguration.xml.i>
+ </children>
+</node>
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-override-capability.xml.i b/interface-definitions/include/bgp/bgp-override-capability.xml.i
index 88c277c8b..1e51a49d5 100644
--- a/interface-definitions/include/bgp-override-capability.xml.i
+++ b/interface-definitions/include/bgp/bgp-override-capability.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from bgp-override-capability.xml.i -->
+<!-- include start from bgp-override-capability.xml.i -->
<leafNode name="override-capability">
<properties>
<help>Ignore capability negotiation with specified neighbor</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-passive.xml.i b/interface-definitions/include/bgp/bgp-passive.xml.i
index ada961866..033cf8231 100644
--- a/interface-definitions/include/bgp-passive.xml.i
+++ b/interface-definitions/include/bgp/bgp-passive.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from bgp-passive.xml.i -->
+<!-- include start from bgp-passive.xml.i -->
<leafNode name="passive">
<properties>
<help>Do not initiate a session with this neighbor</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-password.xml.i b/interface-definitions/include/bgp/bgp-password.xml.i
index 5b68a2d71..f5878cce9 100644
--- a/interface-definitions/include/bgp-password.xml.i
+++ b/interface-definitions/include/bgp/bgp-password.xml.i
@@ -1,7 +1,7 @@
-<!-- included start from bgp-password.xml.i -->
+<!-- include start from bgp-password.xml.i -->
<leafNode name="password">
<properties>
<help>BGP MD5 password</help>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-peer-group.xml.i b/interface-definitions/include/bgp/bgp-peer-group.xml.i
index 73c80e0e4..8fc50794d 100644
--- a/interface-definitions/include/bgp-peer-group.xml.i
+++ b/interface-definitions/include/bgp/bgp-peer-group.xml.i
@@ -1,11 +1,14 @@
-<!-- included start from bgp-peer-group.xml.i -->
+<!-- include start from bgp-peer-group.xml.i -->
<leafNode name="peer-group">
<properties>
<help>Peer group for this peer</help>
+ <completionHelp>
+ <script>${vyos_completion_dir}/list_bgp_peer_groups.sh</script>
+ </completionHelp>
<valueHelp>
<format>txt</format>
<description>Peer-group name</description>
</valueHelp>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-remote-as.xml.i b/interface-definitions/include/bgp/bgp-remote-as.xml.i
index de3f4d2ad..f036fe13d 100644
--- a/interface-definitions/include/bgp-remote-as.xml.i
+++ b/interface-definitions/include/bgp/bgp-remote-as.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-remote-as.xml.i -->
+<!-- include start from bgp-remote-as.xml.i -->
<leafNode name="remote-as">
<properties>
<help>Neighbor BGP AS number [REQUIRED]</help>
@@ -24,4 +24,4 @@
<constraintErrorMessage>Invalid AS number</constraintErrorMessage>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-route-target.xml.i b/interface-definitions/include/bgp/bgp-route-target.xml.i
index c3df56a74..c05ac5dc2 100644
--- a/interface-definitions/include/bgp-route-target.xml.i
+++ b/interface-definitions/include/bgp/bgp-route-target.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-route-target.xml.i -->
+<!-- include start from bgp-route-target.xml.i -->
<node name="route-target">
<properties>
<help>Route Target</help>
@@ -42,4 +42,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-shutdown.xml.i b/interface-definitions/include/bgp/bgp-shutdown.xml.i
index fefbfcebb..f920e9579 100644
--- a/interface-definitions/include/bgp-shutdown.xml.i
+++ b/interface-definitions/include/bgp/bgp-shutdown.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from bgp-shutdown.xml.i -->
+<!-- include start from bgp-shutdown.xml.i -->
<leafNode name="shutdown">
<properties>
<help>Administratively shut down this neighbor</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-timers-holdtime.xml.i b/interface-definitions/include/bgp/bgp-timers-holdtime.xml.i
index 09924574b..9c16127b5 100644
--- a/interface-definitions/include/bgp-timers-holdtime.xml.i
+++ b/interface-definitions/include/bgp/bgp-timers-holdtime.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-timers-holdtime.xml.i -->
+<!-- include start from bgp-timers-holdtime.xml.i -->
<leafNode name="holdtime">
<properties>
<help>BGP hold timer for this neighbor</help>
@@ -15,4 +15,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-timers-keepalive.xml.i b/interface-definitions/include/bgp/bgp-timers-keepalive.xml.i
index 7d294c9d6..8c3e66c6a 100644
--- a/interface-definitions/include/bgp-timers-keepalive.xml.i
+++ b/interface-definitions/include/bgp/bgp-timers-keepalive.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-timers-keepalive.xml.i -->
+<!-- include start from bgp-timers-keepalive.xml.i -->
<leafNode name="keepalive">
<properties>
<help>BGP keepalive interval for this neighbor</help>
@@ -11,4 +11,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-ttl-security.xml.i b/interface-definitions/include/bgp/bgp-ttl-security.xml.i
index 3f4d1786d..1fb1c2c55 100644
--- a/interface-definitions/include/bgp-ttl-security.xml.i
+++ b/interface-definitions/include/bgp/bgp-ttl-security.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-ttl-security.xml.i -->
+<!-- include start from bgp-ttl-security.xml.i -->
<node name="ttl-security">
<properties>
<help>Ttl security mechanism</help>
@@ -18,4 +18,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/bgp-update-source.xml.i b/interface-definitions/include/bgp/bgp-update-source.xml.i
index 3bb79598d..f4ccc3553 100644
--- a/interface-definitions/include/bgp-update-source.xml.i
+++ b/interface-definitions/include/bgp/bgp-update-source.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from bgp-update-source.xml.i -->
+<!-- include start from bgp-update-source.xml.i -->
<leafNode name="update-source">
<!-- Need to check format interfaces -->
<properties>
@@ -26,4 +26,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/certificate-ca.xml.i b/interface-definitions/include/certificate-ca.xml.i
index df12746aa..b97378658 100644
--- a/interface-definitions/include/certificate-ca.xml.i
+++ b/interface-definitions/include/certificate-ca.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from certificate-ca.xml.i -->
+<!-- include start from certificate-ca.xml.i -->
<leafNode name="ca-cert-file">
<properties>
<help>Certificate Authority in x509 PEM format</help>
@@ -11,4 +11,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/certificate-key.xml.i b/interface-definitions/include/certificate-key.xml.i
index 924823c76..1db9dd069 100644
--- a/interface-definitions/include/certificate-key.xml.i
+++ b/interface-definitions/include/certificate-key.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from certificate-key.xml.i -->
+<!-- include start from certificate-key.xml.i -->
<leafNode name="key-file">
<properties>
<help>Certificate private key in x509 PEM format</help>
@@ -11,4 +11,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/certificate.xml.i b/interface-definitions/include/certificate.xml.i
index 724a8a27f..fb5be45cc 100644
--- a/interface-definitions/include/certificate.xml.i
+++ b/interface-definitions/include/certificate.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from certificate.xml.i -->
+<!-- include start from certificate.xml.i -->
<leafNode name="cert-file">
<properties>
<help>Certificate public key in x509 PEM format</help>
@@ -11,4 +11,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/dhcp-server-domain-search.xml.i b/interface-definitions/include/dhcp-server-domain-search.xml.i
index 9b3568b72..4fc55097b 100644
--- a/interface-definitions/include/dhcp-server-domain-search.xml.i
+++ b/interface-definitions/include/dhcp-server-domain-search.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from dhcp-server-domain-search.xml.i -->
+<!-- include start from dhcp-server-domain-search.xml.i -->
<leafNode name="domain-search">
<properties>
<help>Client Domain Name search list</help>
@@ -9,4 +9,4 @@
<multi/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/generic-disable-node.xml.i b/interface-definitions/include/generic-disable-node.xml.i
index 520383afb..bb4fa5c4b 100644
--- a/interface-definitions/include/generic-disable-node.xml.i
+++ b/interface-definitions/include/generic-disable-node.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from generic-disable-node.xml.i -->
+<!-- include start from generic-disable-node.xml.i -->
<leafNode name="disable">
<properties>
<help>Temporary disable</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-ipv4-options.xml.i b/interface-definitions/include/interface-ipv4-options.xml.i
deleted file mode 100644
index c63f89890..000000000
--- a/interface-definitions/include/interface-ipv4-options.xml.i
+++ /dev/null
@@ -1,18 +0,0 @@
-<!-- included start from interface-ipv4-options.xml.i -->
-<node name="ip">
- <properties>
- <help>IPv4 routing parameters</help>
- </properties>
- <children>
- #include <include/interface-arp-cache-timeout.xml.i>
- #include <include/interface-disable-arp-filter.xml.i>
- #include <include/interface-disable-forwarding.xml.i>
- #include <include/interface-enable-arp-accept.xml.i>
- #include <include/interface-enable-arp-announce.xml.i>
- #include <include/interface-enable-arp-ignore.xml.i>
- #include <include/interface-enable-proxy-arp.xml.i>
- #include <include/interface-proxy-arp-pvlan.xml.i>
- #include <include/interface-source-validation.xml.i>
- </children>
-</node>
-<!-- included end -->
diff --git a/interface-definitions/include/interface-ipv6-options.xml.i b/interface-definitions/include/interface-ipv6-options.xml.i
deleted file mode 100644
index a94c6572b..000000000
--- a/interface-definitions/include/interface-ipv6-options.xml.i
+++ /dev/null
@@ -1,12 +0,0 @@
-<!-- included start from interface-ipv6-options.xml.i -->
-<node name="ipv6">
- <properties>
- <help>IPv6 routing parameters</help>
- </properties>
- <children>
- #include <include/ipv6-address.xml.i>
- #include <include/ipv6-disable-forwarding.xml.i>
- #include <include/ipv6-dup-addr-detect-transmits.xml.i>
- </children>
-</node>
-<!-- included end -->
diff --git a/interface-definitions/include/address-ipv4-ipv6-dhcp.xml.i b/interface-definitions/include/interface/address-ipv4-ipv6-dhcp.xml.i
index 7805110bc..b9dd59bea 100644
--- a/interface-definitions/include/address-ipv4-ipv6-dhcp.xml.i
+++ b/interface-definitions/include/interface/address-ipv4-ipv6-dhcp.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from address-ipv4-ipv6-dhcp.xml.i -->
+<!-- include start from address-ipv4-ipv6-dhcp.xml.i -->
<leafNode name="address">
<properties>
<help>IP address</help>
@@ -28,4 +28,4 @@
<multi/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/address-ipv4-ipv6.xml.i b/interface-definitions/include/interface/address-ipv4-ipv6.xml.i
index b11610104..519622050 100644
--- a/interface-definitions/include/address-ipv4-ipv6.xml.i
+++ b/interface-definitions/include/interface/address-ipv4-ipv6.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from address-ipv4-ipv6.xml.i -->
+<!-- include start from address-ipv4-ipv6.xml.i -->
<leafNode name="address">
<properties>
<help>IP address</help>
@@ -16,4 +16,4 @@
<multi/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/dhcp-options.xml.i b/interface-definitions/include/interface/dhcp-options.xml.i
index 774714251..bd327da2d 100644
--- a/interface-definitions/include/dhcp-options.xml.i
+++ b/interface-definitions/include/interface/dhcp-options.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from dhcp-options.xml.i -->
+<!-- include start from interface/dhcp-options.xml.i -->
<node name="dhcp-options">
<properties>
<help>DHCP client settings/options</help>
@@ -39,4 +39,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/dhcpv6-options.xml.i b/interface-definitions/include/interface/dhcpv6-options.xml.i
index 33ba39592..ca478a3eb 100644
--- a/interface-definitions/include/dhcpv6-options.xml.i
+++ b/interface-definitions/include/interface/dhcpv6-options.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from dhcpv6-options.xml.i -->
+<!-- include start from interface/dhcpv6-options.xml.i -->
<node name="dhcpv6-options">
<properties>
<help>DHCPv6 client settings/options</help>
@@ -97,4 +97,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-arp-cache-timeout.xml.i b/interface-definitions/include/interface/interface-arp-cache-timeout.xml.i
index 6dfebfee4..b269fecd8 100644
--- a/interface-definitions/include/interface-arp-cache-timeout.xml.i
+++ b/interface-definitions/include/interface/interface-arp-cache-timeout.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from interface-arp-cache-timeout.xml.i -->
+<!-- include start from interface/interface-arp-cache-timeout.xml.i -->
<leafNode name="arp-cache-timeout">
<properties>
<help>ARP cache entry timeout in seconds</help>
@@ -13,4 +13,4 @@
</properties>
<defaultValue>30</defaultValue>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-description.xml.i b/interface-definitions/include/interface/interface-description.xml.i
index daf09d8bc..d618b50d2 100644
--- a/interface-definitions/include/interface-description.xml.i
+++ b/interface-definitions/include/interface/interface-description.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from interface-description.xml.i -->
+<!-- include start from interface/interface-description.xml.i -->
<leafNode name="description">
<properties>
<help>Interface specific description</help>
@@ -8,4 +8,4 @@
<constraintErrorMessage>Description too long (limit 256 characters)</constraintErrorMessage>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-dial-on-demand.xml.i b/interface-definitions/include/interface/interface-dial-on-demand.xml.i
index 8fba8099d..66edd9678 100644
--- a/interface-definitions/include/interface-dial-on-demand.xml.i
+++ b/interface-definitions/include/interface/interface-dial-on-demand.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from interface-dial-on-demand.xml.i -->
+<!-- include start from interface/interface-dial-on-demand.xml.i -->
<leafNode name="connect-on-demand">
<properties>
<help>Establishment connection automatically when traffic is sent</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-disable-arp-filter.xml.i b/interface-definitions/include/interface/interface-disable-arp-filter.xml.i
index 4de3ca893..49cddaf76 100644
--- a/interface-definitions/include/interface-disable-arp-filter.xml.i
+++ b/interface-definitions/include/interface/interface-disable-arp-filter.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from interface-disable-arp-filter.xml.i -->
+<!-- include start from interface/interface-disable-arp-filter.xml.i -->
<leafNode name="disable-arp-filter">
<properties>
<help>Disable ARP filter on this interface</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-disable-forwarding.xml.i b/interface-definitions/include/interface/interface-disable-forwarding.xml.i
index 7cbb726ec..cb6ef0475 100644
--- a/interface-definitions/include/interface-disable-forwarding.xml.i
+++ b/interface-definitions/include/interface/interface-disable-forwarding.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from interface-disable-forwarding.xml.i -->
+<!-- include start from interface/interface-disable-forwarding.xml.i -->
<leafNode name="disable-forwarding">
<properties>
<help>Disable IPv4 forwarding on this interface</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-disable-link-detect.xml.i b/interface-definitions/include/interface/interface-disable-link-detect.xml.i
index 4298b4b5d..c528885b2 100644
--- a/interface-definitions/include/interface-disable-link-detect.xml.i
+++ b/interface-definitions/include/interface/interface-disable-link-detect.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from interface-disable-link-detect.xml.i -->
+<!-- include start from interface/interface-disable-link-detect.xml.i -->
<leafNode name="disable-link-detect">
<properties>
<help>Ignore link state changes</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-disable.xml.i b/interface-definitions/include/interface/interface-disable.xml.i
index 5d73d54ba..d90e6395b 100644
--- a/interface-definitions/include/interface-disable.xml.i
+++ b/interface-definitions/include/interface/interface-disable.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from interface-disable.xml.i -->
+<!-- include start from interface/interface-disable.xml.i -->
<leafNode name="disable">
<properties>
<help>Administratively disable interface</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-eapol.xml.i b/interface-definitions/include/interface/interface-eapol.xml.i
index 8b33b4acf..92b7a3f35 100644
--- a/interface-definitions/include/interface-eapol.xml.i
+++ b/interface-definitions/include/interface/interface-eapol.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from interface-eapol.xml.i -->
+<!-- include start from interface/interface-eapol.xml.i -->
<node name="eapol">
<properties>
<help>Extensible Authentication Protocol over Local Area Network</help>
@@ -9,4 +9,4 @@
#include <include/certificate-key.xml.i>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-enable-arp-accept.xml.i b/interface-definitions/include/interface/interface-enable-arp-accept.xml.i
index 688b3572e..7c5d51857 100644
--- a/interface-definitions/include/interface-enable-arp-accept.xml.i
+++ b/interface-definitions/include/interface/interface-enable-arp-accept.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from interface-enable-arp-accept.xml.i -->
+<!-- include start from interface/interface-enable-arp-accept.xml.i -->
<leafNode name="enable-arp-accept">
<properties>
<help>Enable ARP accept on this interface</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-enable-arp-announce.xml.i b/interface-definitions/include/interface/interface-enable-arp-announce.xml.i
index c84bb7ea9..f44599c54 100644
--- a/interface-definitions/include/interface-enable-arp-announce.xml.i
+++ b/interface-definitions/include/interface/interface-enable-arp-announce.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from interface-enable-arp-announce.xml.i -->
+<!-- include start from interface/interface-enable-arp-announce.xml.i -->
<leafNode name="enable-arp-announce">
<properties>
<help>Enable ARP announce on this interface</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-enable-arp-ignore.xml.i b/interface-definitions/include/interface/interface-enable-arp-ignore.xml.i
index 741771a89..3ea39613c 100644
--- a/interface-definitions/include/interface-enable-arp-ignore.xml.i
+++ b/interface-definitions/include/interface/interface-enable-arp-ignore.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from interface-enable-arp-ignore.xml.i -->
+<!-- include start from interface/interface-enable-arp-ignore.xml.i -->
<leafNode name="enable-arp-ignore">
<properties>
<help>Enable ARP ignore on this interface</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-enable-proxy-arp.xml.i b/interface-definitions/include/interface/interface-enable-proxy-arp.xml.i
index 08351e673..dbdeeb7a7 100644
--- a/interface-definitions/include/interface-enable-proxy-arp.xml.i
+++ b/interface-definitions/include/interface/interface-enable-proxy-arp.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from interface-enable-proxy-arp.xml.i -->
+<!-- include start from interface/interface-enable-proxy-arp.xml.i -->
<leafNode name="enable-proxy-arp">
<properties>
<help>Enable proxy-arp on this interface</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-hw-id.xml.i b/interface-definitions/include/interface/interface-hw-id.xml.i
index 55ef55add..989cd9cb7 100644
--- a/interface-definitions/include/interface-hw-id.xml.i
+++ b/interface-definitions/include/interface/interface-hw-id.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from interface-hw-id.xml.i -->
+<!-- include start from interface/interface-hw-id.xml.i -->
<leafNode name="hw-id">
<properties>
<help>Associate Ethernet Interface with given Media Access Control (MAC) address</help>
@@ -11,4 +11,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface/interface-ipv4-options.xml.i b/interface-definitions/include/interface/interface-ipv4-options.xml.i
new file mode 100644
index 000000000..c2d0677b7
--- /dev/null
+++ b/interface-definitions/include/interface/interface-ipv4-options.xml.i
@@ -0,0 +1,18 @@
+<!-- include start from interface/interface-ipv4-options.xml.i -->
+<node name="ip">
+ <properties>
+ <help>IPv4 routing parameters</help>
+ </properties>
+ <children>
+ #include <include/interface/interface-arp-cache-timeout.xml.i>
+ #include <include/interface/interface-disable-arp-filter.xml.i>
+ #include <include/interface/interface-disable-forwarding.xml.i>
+ #include <include/interface/interface-enable-arp-accept.xml.i>
+ #include <include/interface/interface-enable-arp-announce.xml.i>
+ #include <include/interface/interface-enable-arp-ignore.xml.i>
+ #include <include/interface/interface-enable-proxy-arp.xml.i>
+ #include <include/interface/interface-proxy-arp-pvlan.xml.i>
+ #include <include/interface/interface-source-validation.xml.i>
+ </children>
+</node>
+<!-- include end -->
diff --git a/interface-definitions/include/interface/interface-ipv6-options.xml.i b/interface-definitions/include/interface/interface-ipv6-options.xml.i
new file mode 100644
index 000000000..dcd5a8710
--- /dev/null
+++ b/interface-definitions/include/interface/interface-ipv6-options.xml.i
@@ -0,0 +1,12 @@
+<!-- include start from interface/interface-ipv6-options.xml.i -->
+<node name="ipv6">
+ <properties>
+ <help>IPv6 routing parameters</help>
+ </properties>
+ <children>
+ #include <include/interface/ipv6-address.xml.i>
+ #include <include/interface/ipv6-disable-forwarding.xml.i>
+ #include <include/interface/ipv6-dup-addr-detect-transmits.xml.i>
+ </children>
+</node>
+<!-- include end -->
diff --git a/interface-definitions/include/interface-mac.xml.i b/interface-definitions/include/interface/interface-mac.xml.i
index 87dc5fb60..d7107ad23 100644
--- a/interface-definitions/include/interface-mac.xml.i
+++ b/interface-definitions/include/interface/interface-mac.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from mac.xml.i -->
+<!-- include start from interface/interface-mac.xml.i -->
<leafNode name="mac">
<properties>
<help>Media Access Control (MAC) address</help>
@@ -11,4 +11,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-mirror.xml.i b/interface-definitions/include/interface/interface-mirror.xml.i
index d34132a9c..b3b45fb43 100644
--- a/interface-definitions/include/interface-mirror.xml.i
+++ b/interface-definitions/include/interface/interface-mirror.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from interface-mirror.xml.i -->
+<!-- include start from interface/interface-mirror.xml.i -->
<node name="mirror">
<properties>
<help>Incoming/outgoing packet mirroring destination</help>
@@ -22,4 +22,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-mtu-1200-16000.xml.i b/interface-definitions/include/interface/interface-mtu-1200-16000.xml.i
index 04b5ec8ac..3241ba912 100644
--- a/interface-definitions/include/interface-mtu-1200-16000.xml.i
+++ b/interface-definitions/include/interface/interface-mtu-1200-16000.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from interface-mtu-1200-16000.xml.i -->
+<!-- include start from interface/interface-mtu-1200-16000.xml.i -->
<leafNode name="mtu">
<properties>
<help>Maximum Transmission Unit (MTU)</help>
@@ -13,4 +13,4 @@
</properties>
<defaultValue>1500</defaultValue>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-mtu-1450-16000.xml.i b/interface-definitions/include/interface/interface-mtu-1450-16000.xml.i
index 41dd5fb00..0a35bbbaa 100644
--- a/interface-definitions/include/interface-mtu-1450-16000.xml.i
+++ b/interface-definitions/include/interface/interface-mtu-1450-16000.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from interface-mtu-1450-16000.xml.i -->
+<!-- include start from interface/interface-mtu-1450-16000.xml.i -->
<leafNode name="mtu">
<properties>
<help>Maximum Transmission Unit (MTU)</help>
@@ -13,4 +13,4 @@
</properties>
<defaultValue>1500</defaultValue>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-mtu-64-8024.xml.i b/interface-definitions/include/interface/interface-mtu-64-8024.xml.i
index 0a455bc64..f75de02ba 100644
--- a/interface-definitions/include/interface-mtu-64-8024.xml.i
+++ b/interface-definitions/include/interface/interface-mtu-64-8024.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from interface-mtu-68-8024.xml.i -->
+<!-- include start from interface/interface-mtu-68-8024.xml.i -->
<leafNode name="mtu">
<properties>
<help>Maximum Transmission Unit (MTU)</help>
@@ -13,4 +13,4 @@
</properties>
<defaultValue>1500</defaultValue>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-mtu-68-1500.xml.i b/interface-definitions/include/interface/interface-mtu-68-1500.xml.i
index 78c2c6920..9e6fe8760 100644
--- a/interface-definitions/include/interface-mtu-68-1500.xml.i
+++ b/interface-definitions/include/interface/interface-mtu-68-1500.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from interface-mtu-68-1500.xml.i -->
+<!-- include start from interface/interface-mtu-68-1500.xml.i -->
<leafNode name="mtu">
<properties>
<help>Maximum Transmission Unit (MTU)</help>
@@ -13,4 +13,4 @@
</properties>
<defaultValue>1500</defaultValue>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-mtu-68-16000.xml.i b/interface-definitions/include/interface/interface-mtu-68-16000.xml.i
index 9f18464bf..83af7bbd4 100644
--- a/interface-definitions/include/interface-mtu-68-16000.xml.i
+++ b/interface-definitions/include/interface/interface-mtu-68-16000.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from interface-mtu-68-16000.xml.i -->
+<!-- include start from interface/interface-mtu-68-16000.xml.i -->
<leafNode name="mtu">
<properties>
<help>Maximum Transmission Unit (MTU)</help>
@@ -13,4 +13,4 @@
</properties>
<defaultValue>1500</defaultValue>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-parameters-dont-fragment.xml.i b/interface-definitions/include/interface/interface-parameters-dont-fragment.xml.i
index a16cc5dee..166c31115 100644
--- a/interface-definitions/include/interface-parameters-dont-fragment.xml.i
+++ b/interface-definitions/include/interface/interface-parameters-dont-fragment.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from interface-parameters-df.xml.i -->
+<!-- include start from interface/interface-parameters-df.xml.i -->
<leafNode name="dont-fragment">
<properties>
<help>Specifies the usage of the dont fragment (DF) bit</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-parameters-flowlabel.xml.i b/interface-definitions/include/interface/interface-parameters-flowlabel.xml.i
index 0723c4b47..ed075e40d 100644
--- a/interface-definitions/include/interface-parameters-flowlabel.xml.i
+++ b/interface-definitions/include/interface/interface-parameters-flowlabel.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from interface-parameters-flowlabel.xml.i -->
+<!-- include start from interface/interface-parameters-flowlabel.xml.i -->
<leafNode name="flowlabel">
<properties>
<help>Specifies the flow label to use in outgoing packets</help>
@@ -12,4 +12,4 @@
<constraintErrorMessage>Must be 'inherit' or a number</constraintErrorMessage>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-parameters-key.xml.i b/interface-definitions/include/interface/interface-parameters-key.xml.i
index e918ff0e8..1b1d67174 100644
--- a/interface-definitions/include/interface-parameters-key.xml.i
+++ b/interface-definitions/include/interface/interface-parameters-key.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from interface-parameters-key.xml.i -->
+<!-- include start from interface/interface-parameters-key.xml.i -->
<leafNode name="key">
<properties>
<help>Tunnel key</help>
@@ -12,4 +12,4 @@
<constraintErrorMessage>key must be between 0-4294967295</constraintErrorMessage>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-parameters-tos.xml.i b/interface-definitions/include/interface/interface-parameters-tos.xml.i
index ebb537bed..83b4e0671 100644
--- a/interface-definitions/include/interface-parameters-tos.xml.i
+++ b/interface-definitions/include/interface/interface-parameters-tos.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from tunnel-parameters-tos.xml.i -->
+<!-- include start from interface/tunnel-parameters-tos.xml.i -->
<leafNode name="tos">
<properties>
<help>Specifies TOS value to use in outgoing packets</help>
@@ -13,4 +13,4 @@
</properties>
<defaultValue>inherit</defaultValue>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-parameters-ttl.xml.i b/interface-definitions/include/interface/interface-parameters-ttl.xml.i
index 83563ecb1..df193cf24 100644
--- a/interface-definitions/include/interface-parameters-ttl.xml.i
+++ b/interface-definitions/include/interface/interface-parameters-ttl.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from interface-parameters-ttl.xml.i -->
+<!-- include start from interface/interface-parameters-ttl.xml.i -->
<leafNode name="ttl">
<properties>
<help>Specifies TTL value to use in outgoing packets</help>
@@ -17,4 +17,4 @@
</properties>
<defaultValue>0</defaultValue>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-proxy-arp-pvlan.xml.i b/interface-definitions/include/interface/interface-proxy-arp-pvlan.xml.i
index 02b96e353..153dfc072 100644
--- a/interface-definitions/include/interface-proxy-arp-pvlan.xml.i
+++ b/interface-definitions/include/interface/interface-proxy-arp-pvlan.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from interface-proxy-arp-pvlan.xml.i -->
+<!-- include start from interface/interface-proxy-arp-pvlan.xml.i -->
<leafNode name="proxy-arp-pvlan">
<properties>
<help>Enable private VLAN proxy ARP on this interface</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-source-validation.xml.i b/interface-definitions/include/interface/interface-source-validation.xml.i
index 32cec464e..70914f2e9 100644
--- a/interface-definitions/include/interface-source-validation.xml.i
+++ b/interface-definitions/include/interface/interface-source-validation.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from interface-source-validation.xml.i -->
+<!-- include start from interface/interface-source-validation.xml.i -->
<leafNode name="source-validation">
<properties>
<help>Source validation by reversed path (RFC3704)</help>
@@ -22,4 +22,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-vrf.xml.i b/interface-definitions/include/interface/interface-vrf.xml.i
index e3d6b53e0..ef6ca1241 100644
--- a/interface-definitions/include/interface-vrf.xml.i
+++ b/interface-definitions/include/interface/interface-vrf.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from interface-vrf.xml.i -->
+<!-- include start from interface/interface-vrf.xml.i -->
<leafNode name="vrf">
<properties>
<help>VRF instance name</help>
@@ -11,4 +11,4 @@
</completionHelp>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface-xdp.xml.i b/interface-definitions/include/interface/interface-xdp.xml.i
index d224c177f..0253f6dad 100644
--- a/interface-definitions/include/interface-xdp.xml.i
+++ b/interface-definitions/include/interface/interface-xdp.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from interface-vrf.xml.i -->
+<!-- include start from interface/interface-xdp.xml.i -->
<leafNode name="xdp">
<properties>
<help>Enable eXpress Data Path</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/ipv6-address-autoconf.xml.i b/interface-definitions/include/interface/ipv6-address-autoconf.xml.i
index 580f060d7..cd1483bc1 100644
--- a/interface-definitions/include/ipv6-address-autoconf.xml.i
+++ b/interface-definitions/include/interface/ipv6-address-autoconf.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from ipv6-address-autoconf.xml.i -->
+<!-- include start from interface/ipv6-address-autoconf.xml.i -->
<leafNode name="autoconf">
<properties>
<help>Enable acquisition of IPv6 address using stateless autoconfig (SLAAC)</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface/ipv6-address-eui64.xml.i b/interface-definitions/include/interface/ipv6-address-eui64.xml.i
new file mode 100644
index 000000000..fe1f43df4
--- /dev/null
+++ b/interface-definitions/include/interface/ipv6-address-eui64.xml.i
@@ -0,0 +1,16 @@
+<!-- include start from interface/ipv6-address-eui64.xml.i -->
+<leafNode name="eui64">
+ <properties>
+ <help>Prefix for IPv6 address with MAC-based EUI-64</help>
+ <valueHelp>
+ <format>&lt;h:h:h:h:h:h:h:h/64&gt;</format>
+ <description>IPv6 /64 network</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv6-eui64-prefix"/>
+ </constraint>
+ <constraintErrorMessage>EUI64 prefix length must be 64</constraintErrorMessage>
+ <multi/>
+ </properties>
+</leafNode>
+<!-- include end -->
diff --git a/interface-definitions/include/ipv6-address-no-default-link-local.xml.i b/interface-definitions/include/interface/ipv6-address-no-default-link-local.xml.i
index 1c9e832dc..012490edc 100644
--- a/interface-definitions/include/ipv6-address-no-default-link-local.xml.i
+++ b/interface-definitions/include/interface/ipv6-address-no-default-link-local.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from ipv6-address-no-default-link-local.xml.i -->
+<!-- include start from interface/ipv6-address-no-default-link-local.xml.i -->
<leafNode name="no-default-link-local">
<properties>
<help>Remove the default link-local address from the interface</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/interface/ipv6-address.xml.i b/interface-definitions/include/interface/ipv6-address.xml.i
new file mode 100644
index 000000000..e1bdf02fd
--- /dev/null
+++ b/interface-definitions/include/interface/ipv6-address.xml.i
@@ -0,0 +1,12 @@
+<!-- include start from interface/ipv6-address.xml.i -->
+<node name="address">
+ <properties>
+ <help>IPv6 address configuration modes</help>
+ </properties>
+ <children>
+ #include <include/interface/ipv6-address-autoconf.xml.i>
+ #include <include/interface/ipv6-address-eui64.xml.i>
+ #include <include/interface/ipv6-address-no-default-link-local.xml.i>
+ </children>
+</node>
+<!-- include end -->
diff --git a/interface-definitions/include/ipv6-disable-forwarding.xml.i b/interface-definitions/include/interface/ipv6-disable-forwarding.xml.i
index 14d9eada9..4adb77d1b 100644
--- a/interface-definitions/include/ipv6-disable-forwarding.xml.i
+++ b/interface-definitions/include/interface/ipv6-disable-forwarding.xml.i
@@ -1,8 +1,8 @@
-<!-- included start from ipv6-disable-forwarding.xml.i -->
+<!-- include start from interface/ipv6-disable-forwarding.xml.i -->
<leafNode name="disable-forwarding">
<properties>
<help>Disable IPv6 forwarding on this interface</help>
<valueless/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/ipv6-dup-addr-detect-transmits.xml.i b/interface-definitions/include/interface/ipv6-dup-addr-detect-transmits.xml.i
index 61e6669c4..2b5ec0281 100644
--- a/interface-definitions/include/ipv6-dup-addr-detect-transmits.xml.i
+++ b/interface-definitions/include/interface/ipv6-dup-addr-detect-transmits.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from ipv6-dup-addr-detect-transmits.xml.i -->
+<!-- include start from interface/ipv6-dup-addr-detect-transmits.xml.i -->
<leafNode name="dup-addr-detect-transmits">
<properties>
<help>Number of NS messages to send while performing DAD (default: 1)</help>
@@ -15,4 +15,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/tunnel-remote.xml.i b/interface-definitions/include/interface/tunnel-remote.xml.i
index d5b50d3f6..1ba9b0382 100644
--- a/interface-definitions/include/tunnel-remote.xml.i
+++ b/interface-definitions/include/interface/tunnel-remote.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from tunnel-remote.xml.i -->
+<!-- include start from rip/tunnel-remote.xml.i -->
<leafNode name="remote">
<properties>
<help>Tunnel remote address</help>
@@ -15,4 +15,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/vif-s.xml.i b/interface-definitions/include/interface/vif-s.xml.i
index 01cb59efc..045fd3e24 100644
--- a/interface-definitions/include/vif-s.xml.i
+++ b/interface-definitions/include/interface/vif-s.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from vif-s.xml.i -->
+<!-- include start from interface/vif-s.xml.i -->
<tagNode name="vif-s">
<properties>
<help>QinQ TAG-S Virtual Local Area Network (VLAN) ID</help>
@@ -8,12 +8,12 @@
<constraintErrorMessage>VLAN ID must be between 0 and 4094</constraintErrorMessage>
</properties>
<children>
- #include <include/address-ipv4-ipv6-dhcp.xml.i>
- #include <include/interface-description.xml.i>
- #include <include/dhcp-options.xml.i>
- #include <include/dhcpv6-options.xml.i>
- #include <include/interface-disable-link-detect.xml.i>
- #include <include/interface-disable.xml.i>
+ #include <include/interface/address-ipv4-ipv6-dhcp.xml.i>
+ #include <include/interface/interface-description.xml.i>
+ #include <include/interface/dhcp-options.xml.i>
+ #include <include/interface/dhcpv6-options.xml.i>
+ #include <include/interface/interface-disable-link-detect.xml.i>
+ #include <include/interface/interface-disable.xml.i>
<leafNode name="protocol">
<properties>
<help>Protocol used for service VLAN (default: 802.1ad)</help>
@@ -35,10 +35,10 @@
</properties>
<defaultValue>802.1ad</defaultValue>
</leafNode>
- #include <include/interface-ipv4-options.xml.i>
- #include <include/interface-ipv6-options.xml.i>
- #include <include/interface-mac.xml.i>
- #include <include/interface-mtu-68-16000.xml.i>
+ #include <include/interface/interface-ipv4-options.xml.i>
+ #include <include/interface/interface-ipv6-options.xml.i>
+ #include <include/interface/interface-mac.xml.i>
+ #include <include/interface/interface-mtu-68-16000.xml.i>
<tagNode name="vif-c">
<properties>
<help>QinQ TAG-C Virtual Local Area Network (VLAN) ID</help>
@@ -48,20 +48,20 @@
<constraintErrorMessage>VLAN ID must be between 0 and 4094</constraintErrorMessage>
</properties>
<children>
- #include <include/address-ipv4-ipv6-dhcp.xml.i>
- #include <include/interface-description.xml.i>
- #include <include/dhcp-options.xml.i>
- #include <include/dhcpv6-options.xml.i>
- #include <include/interface-disable-link-detect.xml.i>
- #include <include/interface-disable.xml.i>
- #include <include/interface-ipv4-options.xml.i>
- #include <include/interface-ipv6-options.xml.i>
- #include <include/interface-mac.xml.i>
- #include <include/interface-mtu-68-16000.xml.i>
- #include <include/interface-vrf.xml.i>
+ #include <include/interface/address-ipv4-ipv6-dhcp.xml.i>
+ #include <include/interface/interface-description.xml.i>
+ #include <include/interface/dhcp-options.xml.i>
+ #include <include/interface/dhcpv6-options.xml.i>
+ #include <include/interface/interface-disable-link-detect.xml.i>
+ #include <include/interface/interface-disable.xml.i>
+ #include <include/interface/interface-ipv4-options.xml.i>
+ #include <include/interface/interface-ipv6-options.xml.i>
+ #include <include/interface/interface-mac.xml.i>
+ #include <include/interface/interface-mtu-68-16000.xml.i>
+ #include <include/interface/interface-vrf.xml.i>
</children>
</tagNode>
- #include <include/interface-vrf.xml.i>
+ #include <include/interface/interface-vrf.xml.i>
</children>
</tagNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/vif.xml.i b/interface-definitions/include/interface/vif.xml.i
index bc60dd04d..0355054a4 100644
--- a/interface-definitions/include/vif.xml.i
+++ b/interface-definitions/include/interface/vif.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from vif.xml.i -->
+<!-- include start from interface/vif.xml.i -->
<tagNode name="vif">
<properties>
<help>Virtual Local Area Network (VLAN) ID</help>
@@ -12,13 +12,13 @@
<constraintErrorMessage>VLAN ID must be between 0 and 4094</constraintErrorMessage>
</properties>
<children>
- #include <include/address-ipv4-ipv6-dhcp.xml.i>
- #include <include/interface-description.xml.i>
- #include <include/dhcp-options.xml.i>
- #include <include/dhcpv6-options.xml.i>
- #include <include/interface-disable-link-detect.xml.i>
- #include <include/interface-disable.xml.i>
- #include <include/interface-vrf.xml.i>
+ #include <include/interface/address-ipv4-ipv6-dhcp.xml.i>
+ #include <include/interface/interface-description.xml.i>
+ #include <include/interface/dhcp-options.xml.i>
+ #include <include/interface/dhcpv6-options.xml.i>
+ #include <include/interface/interface-disable-link-detect.xml.i>
+ #include <include/interface/interface-disable.xml.i>
+ #include <include/interface/interface-vrf.xml.i>
<leafNode name="egress-qos">
<properties>
<help>VLAN egress QoS</help>
@@ -43,10 +43,10 @@
<constraintErrorMessage>QoS mapping should be in the format of '0:7 2:3' with numbers 0-9</constraintErrorMessage>
</properties>
</leafNode>
- #include <include/interface-ipv4-options.xml.i>
- #include <include/interface-ipv6-options.xml.i>
- #include <include/interface-mac.xml.i>
- #include <include/interface-mtu-68-16000.xml.i>
+ #include <include/interface/interface-ipv4-options.xml.i>
+ #include <include/interface/interface-ipv6-options.xml.i>
+ #include <include/interface/interface-mac.xml.i>
+ #include <include/interface/interface-mtu-68-16000.xml.i>
</children>
</tagNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/ipv6-address-eui64.xml.i b/interface-definitions/include/ipv6-address-eui64.xml.i
deleted file mode 100644
index 093a1dc79..000000000
--- a/interface-definitions/include/ipv6-address-eui64.xml.i
+++ /dev/null
@@ -1,15 +0,0 @@
-<!-- included start from ipv6-address-eui64.xml.i -->
-<leafNode name="eui64">
- <properties>
- <help>Prefix for IPv6 address with MAC-based EUI-64</help>
- <valueHelp>
- <format>ipv6net</format>
- <description>IPv6 network and prefix length</description>
- </valueHelp>
- <constraint>
- <validator name="ipv6-prefix"/>
- </constraint>
- <multi/>
- </properties>
-</leafNode>
-<!-- included end -->
diff --git a/interface-definitions/include/ipv6-address.xml.i b/interface-definitions/include/ipv6-address.xml.i
deleted file mode 100644
index 276456248..000000000
--- a/interface-definitions/include/ipv6-address.xml.i
+++ /dev/null
@@ -1,12 +0,0 @@
-<!-- included start from ipv6-address.xml.i -->
-<node name="address">
- <properties>
- <help>IPv6 address configuration modes</help>
- </properties>
- <children>
- #include <include/ipv6-address-autoconf.xml.i>
- #include <include/ipv6-address-eui64.xml.i>
- #include <include/ipv6-address-no-default-link-local.xml.i>
- </children>
-</node>
-<!-- included end -->
diff --git a/interface-definitions/include/isis/isis-common-config.xml.i b/interface-definitions/include/isis/isis-common-config.xml.i
new file mode 100644
index 000000000..8b753b082
--- /dev/null
+++ b/interface-definitions/include/isis/isis-common-config.xml.i
@@ -0,0 +1,755 @@
+<!-- include start from isis/isis-common-config.xml.i -->
+<node name="area-password">
+ <properties>
+ <help>Configure the authentication password for an area</help>
+ </properties>
+ <children>
+ <leafNode name="plaintext-password">
+ <properties>
+ <help>Plain-text authentication type</help>
+ <valueHelp>
+ <format>txt</format>
+ <description>Level-wide password</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ <leafNode name="md5">
+ <properties>
+ <help>MD5 authentication type</help>
+ <valueHelp>
+ <format>txt</format>
+ <description>Level-wide password</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ </children>
+</node>
+<node name="default-information">
+ <properties>
+ <help>Control distribution of default information</help>
+ </properties>
+ <children>
+ <node name="originate">
+ <properties>
+ <help>Distribute a default route</help>
+ </properties>
+ <children>
+ <node name="ipv4">
+ <properties>
+ <help>Distribute default route for IPv4</help>
+ </properties>
+ <children>
+ <leafNode name="level-1">
+ <properties>
+ <help>Distribute default route into level-1</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="level-2">
+ <properties>
+ <help>Distribute default route into level-2</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <node name="ipv6">
+ <properties>
+ <help>Distribute default route for IPv6</help>
+ </properties>
+ <children>
+ <leafNode name="level-1">
+ <properties>
+ <help>Distribute default route into level-1</help>
+ <completionHelp>
+ <list>always</list>
+ </completionHelp>
+ <valueHelp>
+ <format>always</format>
+ <description>Always advertise default route</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ <leafNode name="level-2">
+ <properties>
+ <help>Distribute default route into level-2</help>
+ <completionHelp>
+ <list>always</list>
+ </completionHelp>
+ <valueHelp>
+ <format>always</format>
+ <description>Always advertise default route</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ </children>
+ </node>
+ </children>
+</node>
+<node name="domain-password">
+ <properties>
+ <help>Set the authentication password for a routing domain</help>
+ </properties>
+ <children>
+ <leafNode name="plaintext-password">
+ <properties>
+ <help>Plain-text authentication type</help>
+ <valueHelp>
+ <format>txt</format>
+ <description>Level-wide password</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+<!--
+ <leafNode name="md5">
+ <properties>
+ <help>MD5 authentication type</help>
+ <valueHelp>
+ <format>txt</format>
+ <description>Level-wide password</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+-->
+ </children>
+</node>
+<leafNode name="dynamic-hostname">
+ <properties>
+ <help>Dynamic hostname for IS-IS</help>
+ <valueless/>
+ </properties>
+</leafNode>
+<leafNode name="level">
+ <properties>
+ <help>IS-IS level number</help>
+ <completionHelp>
+ <list>level-1 level-1-2 level-2</list>
+ </completionHelp>
+ <valueHelp>
+ <format>level-1</format>
+ <description>Act as a station router</description>
+ </valueHelp>
+ <valueHelp>
+ <format>level-1-2</format>
+ <description>Act as both a station and an area router</description>
+ </valueHelp>
+ <valueHelp>
+ <format>level-2</format>
+ <description>Act as an area router</description>
+ </valueHelp>
+ <constraint>
+ <regex>(level-1|level-1-2|level-2)</regex>
+ </constraint>
+ </properties>
+</leafNode>
+<leafNode name="lsp-gen-interval">
+ <properties>
+ <help>Minimum interval between regenerating same LSP</help>
+ <valueHelp>
+ <format>u32:1-120</format>
+ <description>Minimum interval in seconds</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-120"/>
+ </constraint>
+ </properties>
+</leafNode>
+<leafNode name="lsp-mtu">
+ <properties>
+ <help>Configure the maximum size of generated LSPs</help>
+ <valueHelp>
+ <format>u32:128-4352</format>
+ <description>Maximum size of generated LSPs</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 128-4352"/>
+ </constraint>
+ </properties>
+</leafNode>
+<leafNode name="lsp-refresh-interval">
+ <properties>
+ <help>LSP refresh interval</help>
+ <valueHelp>
+ <format>u32:1-65235</format>
+ <description>LSP refresh interval in seconds</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-65235"/>
+ </constraint>
+ </properties>
+</leafNode>
+<leafNode name="max-lsp-lifetime">
+ <properties>
+ <help>Maximum LSP lifetime</help>
+ <valueHelp>
+ <format>u32:350-65535</format>
+ <description>LSP lifetime in seconds</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-65535"/>
+ </constraint>
+ </properties>
+</leafNode>
+<leafNode name="metric-style">
+ <properties>
+ <help>Use old-style (ISO 10589) or new-style packet formats</help>
+ <completionHelp>
+ <list>narrow transition wide</list>
+ </completionHelp>
+ <valueHelp>
+ <format>narrow</format>
+ <description>Use old style of TLVs with narrow metric</description>
+ </valueHelp>
+ <valueHelp>
+ <format>transition</format>
+ <description>Send and accept both styles of TLVs during transition</description>
+ </valueHelp>
+ <valueHelp>
+ <format>wide</format>
+ <description>Use new style of TLVs to carry wider metric</description>
+ </valueHelp>
+ <constraint>
+ <regex>(narrow|transition|wide)</regex>
+ </constraint>
+ </properties>
+</leafNode>
+<leafNode name="net">
+ <properties>
+ <help>A Network Entity Title for this process (ISO only)</help>
+ <valueHelp>
+ <format>XX.XXXX. ... .XXX.XX</format>
+ <description>Network entity title (NET)</description>
+ </valueHelp>
+ <constraint>
+ <regex>[a-fA-F0-9]{2}(\.[a-fA-F0-9]{4}){3,9}\.[a-fA-F0-9]{2}</regex>
+ </constraint>
+ </properties>
+</leafNode>
+<leafNode name="purge-originator">
+ <properties>
+ <help>Use the RFC 6232 purge-originator</help>
+ <valueless/>
+ </properties>
+</leafNode>
+<node name="traffic-engineering">
+ <properties>
+ <help>Show IS-IS neighbor adjacencies</help>
+ </properties>
+ <children>
+ <leafNode name="enable">
+ <properties>
+ <help>Enable MPLS traffic engineering extensions</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+<!--
+ <node name="inter-as">
+ <properties>
+ <help>MPLS traffic engineering inter-AS support</help>
+ </properties>
+ <children>
+ <leafNode name="level-1">
+ <properties>
+ <help>Area native mode self originate inter-AS LSP with L1 only flooding scope</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="level-1-2">
+ <properties>
+ <help>Area native mode self originate inter-AS LSP with L1 and L2 flooding scope</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="level-2">
+ <properties>
+ <help>Area native mode self originate inter-AS LSP with L2 only flooding scope</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <leafNode name="inter-as">
+ <properties>
+ <help>MPLS traffic engineering inter-AS support</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+-->
+ <leafNode name="address">
+ <properties>
+ <help>MPLS traffic engineering router ID</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>IPv4 address</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-address"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+</node>
+<node name="segment-routing">
+ <properties>
+ <help>Segment-Routing (SPRING) settings</help>
+ </properties>
+ <children>
+ <leafNode name="enable">
+ <properties>
+ <help>Enable segment-routing functionality</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <node name="global-block">
+ <properties>
+ <help>Global block label range</help>
+ </properties>
+ <children>
+ <leafNode name="low-label-value">
+ <properties>
+ <help>The lower bound of the global block</help>
+ <valueHelp>
+ <format>u32:16-1048575</format>
+ <description>MPLS label value</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 16-1048575"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="high-label-value">
+ <properties>
+ <help>The upper bound of the global block</help>
+ <valueHelp>
+ <format>u32:16-1048575</format>
+ <description>MPLS label value</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 16-1048575"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+<!--
+ <node name="local-block">
+ <properties>
+ <help>Local Block label range</help>
+ </properties>
+ <children>
+ <leafNode name="low-label-value">
+ <properties>
+ <help>The lower bound of the local block</help>
+ <valueHelp>
+ <format>u32:16-1048575</format>
+ <description>MPLS label value</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument=" range 16-1048575"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="high-label-value">
+ <properties>
+ <help>The upper bound of the local block</help>
+ <valueHelp>
+ <format>u32:16-1048575</format>
+ <description>MPLS label value</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument=" range 16-1048575"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+-->
+ <leafNode name="maximum-label-depth">
+ <properties>
+ <help>Maximum MPLS labels allowed for this router</help>
+ <valueHelp>
+ <format>u32:1-16</format>
+ <description>MPLS label depth</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-16"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <tagNode name="prefix">
+ <properties>
+ <help>Static IPv4/IPv6 prefix segment/label mapping</help>
+ <valueHelp>
+ <format>ipv4net</format>
+ <description>IPv4 prefix segment</description>
+ </valueHelp>
+ <valueHelp>
+ <format>ipv6net</format>
+ <description>IPv6 prefix segment</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-prefix"/>
+ <validator name="ipv6-prefix"/>
+ </constraint>
+ </properties>
+ <children>
+ <node name="absolute">
+ <properties>
+ <help>Specify the absolute value of prefix segment/label ID</help>
+ </properties>
+ <children>
+ <leafNode name="value">
+ <properties>
+ <help>Specify the absolute value of prefix segment/label ID</help>
+ <valueHelp>
+ <format>u32:16-1048575</format>
+ <description>The absolute segment/label ID value</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 16-1048575"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="explicit-null">
+ <properties>
+ <help>Request upstream neighbor to replace segment/label with explicit null label</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="no-php-flag">
+ <properties>
+ <help>Do not request penultimate hop popping for segment/label</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <node name="index">
+ <properties>
+ <help>Specify the index value of prefix segment/label ID</help>
+ </properties>
+ <children>
+ <leafNode name="value">
+ <properties>
+ <help>Specify the index value of prefix segment/label ID</help>
+ <valueHelp>
+ <format>u32:0-65535</format>
+ <description>The index segment/label ID value</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-65535"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="explicit-null">
+ <properties>
+ <help>Request upstream neighbor to replace segment/label with explicit null label</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="no-php-flag">
+ <properties>
+ <help>Do not request penultimate hop popping for segment/label</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ </children>
+ </tagNode>
+ </children>
+</node>
+<node name="redistribute">
+ <properties>
+ <help>Redistribute information from another routing protocol</help>
+ </properties>
+ <children>
+ <node name="ipv4">
+ <properties>
+ <help>Redistribute IPv4 routes</help>
+ </properties>
+ <children>
+ <node name="bgp">
+ <properties>
+ <help>Border Gateway Protocol (BGP)</help>
+ </properties>
+ <children>
+ #include <include/isis/isis-redistribute-ipv4.xml.i>
+ </children>
+ </node>
+ <node name="connected">
+ <properties>
+ <help>Redistribute connected routes into IS-IS</help>
+ </properties>
+ <children>
+ #include <include/isis/isis-redistribute-ipv4.xml.i>
+ </children>
+ </node>
+ <node name="kernel">
+ <properties>
+ <help>Redistribute kernel routes into IS-IS</help>
+ </properties>
+ <children>
+ #include <include/isis/isis-redistribute-ipv4.xml.i>
+ </children>
+ </node>
+ <node name="ospf">
+ <properties>
+ <help>Redistribute OSPF routes into IS-IS</help>
+ </properties>
+ <children>
+ #include <include/isis/isis-redistribute-ipv4.xml.i>
+ </children>
+ </node>
+ <node name="rip">
+ <properties>
+ <help>Redistribute RIP routes into IS-IS</help>
+ </properties>
+ <children>
+ #include <include/isis/isis-redistribute-ipv4.xml.i>
+ </children>
+ </node>
+ <node name="static">
+ <properties>
+ <help>Redistribute static routes into IS-IS</help>
+ </properties>
+ <children>
+ #include <include/isis/isis-redistribute-ipv4.xml.i>
+ </children>
+ </node>
+ </children>
+ </node>
+ </children>
+</node>
+<leafNode name="set-attached-bit">
+ <properties>
+ <help>Set attached bit to identify as L1/L2 router for inter-area traffic</help>
+ <valueless/>
+ </properties>
+</leafNode>
+<leafNode name="set-overload-bit">
+ <properties>
+ <help>Set overload bit to avoid any transit traffic</help>
+ <valueless/>
+ </properties>
+</leafNode>
+<node name="spf-delay-ietf">
+ <properties>
+ <help>IETF SPF delay algorithm</help>
+ </properties>
+ <children>
+ <leafNode name="init-delay">
+ <properties>
+ <help>Delay used while in QUIET state</help>
+ <valueHelp>
+ <format>u32:0-60000</format>
+ <description>Delay used while in QUIET state (in ms)</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-60000"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="short-delay">
+ <properties>
+ <help>Delay used while in SHORT_WAIT state</help>
+ <valueHelp>
+ <format>u32:0-60000</format>
+ <description>Delay used while in SHORT_WAIT state (in ms)</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-60000"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="long-delay">
+ <properties>
+ <help>Delay used while in LONG_WAIT</help>
+ <valueHelp>
+ <format>u32:0-60000</format>
+ <description>Delay used while in LONG_WAIT state (in ms)</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-60000"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="holddown">
+ <properties>
+ <help>Time with no received IGP events before considering IGP stable</help>
+ <valueHelp>
+ <format>u32:0-60000</format>
+ <description>Time with no received IGP events before considering IGP stable (in ms)</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-60000"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="time-to-learn">
+ <properties>
+ <help>Maximum duration needed to learn all the events related to a single failure</help>
+ <valueHelp>
+ <format>u32:0-60000</format>
+ <description>Maximum duration needed to learn all the events related to a single failure (in ms)</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-60000"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+</node>
+<leafNode name="spf-interval">
+ <properties>
+ <help>Minimum interval between SPF calculations</help>
+ <valueHelp>
+ <format>u32:1-120</format>
+ <description>Minimum interval between consecutive SPFs in seconds</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-120"/>
+ </constraint>
+ </properties>
+</leafNode>
+<tagNode name="interface">
+ <!-- (config-if)# ip router isis WORD (same as name of IS-IS process)
+ if any section of "interface" pesent -->
+ <properties>
+ <help>Interface params</help>
+ <completionHelp>
+ <script>${vyos_completion_dir}/list_interfaces.py</script>
+ </completionHelp>
+ </properties>
+ <children>
+ #include <include/bfd.xml.i>
+ <leafNode name="circuit-type">
+ <properties>
+ <help>Configure circuit type for interface</help>
+ <completionHelp>
+ <list>level-1 level-1-2 level-2-only</list>
+ </completionHelp>
+ <valueHelp>
+ <format>level-1</format>
+ <description>Level-1 only adjacencies are formed</description>
+ </valueHelp>
+ <valueHelp>
+ <format>level-1-2</format>
+ <description>Level-1-2 adjacencies are formed</description>
+ </valueHelp>
+ <valueHelp>
+ <format>level-2-only</format>
+ <description>Level-2 only adjacencies are formed</description>
+ </valueHelp>
+ <constraint>
+ <regex>(level-1|level-1-2|level-2-only)</regex>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="hello-padding">
+ <properties>
+ <help>Add padding to IS-IS hello packets</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="hello-interval">
+ <properties>
+ <help>Set Hello interval</help>
+ <valueHelp>
+ <format>u32:1-600</format>
+ <description>Set Hello interval</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-600"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="hello-multiplier">
+ <properties>
+ <help>Set Hello interval</help>
+ <valueHelp>
+ <format>u32:2-100</format>
+ <description>Set multiplier for Hello holding time</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 2-100"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="metric">
+ <properties>
+ <help>Set default metric for circuit</help>
+ <valueHelp>
+ <format>u32:0-16777215</format>
+ <description>Default metric value</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-16777215"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <node name="network">
+ <properties>
+ <help>Set network type</help>
+ </properties>
+ <children>
+ <leafNode name="point-to-point">
+ <properties>
+ <help>point-to-point network type</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ #include <include/isis/passive.xml.i>
+ <node name="password">
+ <properties>
+ <help>Configure the authentication password for a circuit</help>
+ </properties>
+ <children>
+ <leafNode name="plaintext-password">
+ <properties>
+ <help>Plain-text authentication type</help>
+ <valueHelp>
+ <format>txt</format>
+ <description>Circuit password</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <leafNode name="priority">
+ <properties>
+ <help>Set priority for Designated Router election</help>
+ <valueHelp>
+ <format>u32:0-127</format>
+ <description>Priority value</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-127"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="psnp-interval">
+ <properties>
+ <help>Set PSNP interval in seconds</help>
+ <valueHelp>
+ <format>u32:0-127</format>
+ <description>Priority value</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-127"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="no-three-way-handshake">
+ <properties>
+ <help>Disable three-way handshake</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </children>
+</tagNode>
+<!-- include end -->
diff --git a/interface-definitions/include/isis-redistribute-ipv4.xml.i b/interface-definitions/include/isis/isis-redistribute-ipv4.xml.i
index 97ab64250..df48b4d28 100644
--- a/interface-definitions/include/isis-redistribute-ipv4.xml.i
+++ b/interface-definitions/include/isis/isis-redistribute-ipv4.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from isis-redistribute-ipv4.xml.i -->
+<!-- include start from isis/isis-redistribute-ipv4.xml.i -->
<node name="level-1">
<properties>
<help>Redistribute into level-1</help>
@@ -53,4 +53,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/isis/passive.xml.i b/interface-definitions/include/isis/passive.xml.i
new file mode 100644
index 000000000..6d05f8cc7
--- /dev/null
+++ b/interface-definitions/include/isis/passive.xml.i
@@ -0,0 +1,8 @@
+<!-- include start from isis/passive.xml.i -->
+<leafNode name="passive">
+ <properties>
+ <help>Configure passive mode for interface</help>
+ <valueless/>
+ </properties>
+</leafNode>
+<!-- include end -->
diff --git a/interface-definitions/include/listen-address-ipv4.xml.i b/interface-definitions/include/listen-address-ipv4.xml.i
index 530dbf619..ee52cebe8 100644
--- a/interface-definitions/include/listen-address-ipv4.xml.i
+++ b/interface-definitions/include/listen-address-ipv4.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from listen-address-ipv4.xml.i -->
+<!-- include start from listen-address-ipv4.xml.i -->
<leafNode name="listen-address">
<properties>
<help>Local IPv4 addresses for service to listen on</help>
@@ -15,4 +15,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/listen-address.xml.i b/interface-definitions/include/listen-address.xml.i
index 5bfb7eb38..9b86851c7 100644
--- a/interface-definitions/include/listen-address.xml.i
+++ b/interface-definitions/include/listen-address.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from listen-address.xml.i -->
+<!-- include start from listen-address.xml.i -->
<leafNode name="listen-address">
<properties>
<help>Local IP addresses for service to listen on</help>
@@ -20,4 +20,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/nat-address.xml.i b/interface-definitions/include/nat-address.xml.i
index 846ef3dec..a6460ac0f 100644
--- a/interface-definitions/include/nat-address.xml.i
+++ b/interface-definitions/include/nat-address.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from nat-address.xml.i -->
+<!-- include start from nat-address.xml.i -->
<leafNode name="address">
<properties>
<help>IP address, subnet, or range</help>
@@ -36,4 +36,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/nat-interface.xml.i b/interface-definitions/include/nat-interface.xml.i
index e42003530..68969472f 100644
--- a/interface-definitions/include/nat-interface.xml.i
+++ b/interface-definitions/include/nat-interface.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from nat-interface.xml.i -->
+<!-- include start from nat-interface.xml.i -->
<leafNode name="outbound-interface">
<properties>
<help>Outbound interface of NAT traffic</help>
@@ -8,4 +8,4 @@
</completionHelp>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/nat-port.xml.i b/interface-definitions/include/nat-port.xml.i
index 6465c00e9..ebba43712 100644
--- a/interface-definitions/include/nat-port.xml.i
+++ b/interface-definitions/include/nat-port.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from nat-port.xml.i -->
+<!-- include start from nat-port.xml.i -->
<leafNode name="port">
<properties>
<help>Port number</help>
@@ -16,4 +16,4 @@
</valueHelp>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/nat-rule.xml.i b/interface-definitions/include/nat-rule.xml.i
index 7ef90f07e..579d19bdd 100644
--- a/interface-definitions/include/nat-rule.xml.i
+++ b/interface-definitions/include/nat-rule.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from nat-rule.xml.i -->
+<!-- include start from nat-rule.xml.i -->
<tagNode name="rule">
<properties>
<help>Rule number for NAT</help>
@@ -298,4 +298,4 @@
</node>
</children>
</tagNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/nat-translation-port.xml.i b/interface-definitions/include/nat-translation-port.xml.i
index a3e05316f..6e507353c 100644
--- a/interface-definitions/include/nat-translation-port.xml.i
+++ b/interface-definitions/include/nat-translation-port.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from nat-translation-port.xml.i -->
+<!-- include start from nat-translation-port.xml.i -->
<leafNode name="port">
<properties>
<help>Port number</help>
@@ -12,4 +12,4 @@
</valueHelp>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/ospf-authentication.xml.i b/interface-definitions/include/ospf/ospf-authentication.xml.i
index efb29c1f0..322c002e4 100644
--- a/interface-definitions/include/ospf-authentication.xml.i
+++ b/interface-definitions/include/ospf/ospf-authentication.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from ospf-authentication.xml.i -->
+<!-- include start from ospf/ospf-authentication.xml.i -->
<node name="authentication">
<properties>
<help>Authentication</help>
@@ -53,4 +53,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/ospf/ospf-common-config.xml.i b/interface-definitions/include/ospf/ospf-common-config.xml.i
new file mode 100644
index 000000000..7316af670
--- /dev/null
+++ b/interface-definitions/include/ospf/ospf-common-config.xml.i
@@ -0,0 +1,761 @@
+<!-- include start from ospf/ospf-common-config.xml.i -->
+<tagNode name="access-list">
+ <properties>
+ <help>Access list to filter networks in routing updates</help>
+ <completionHelp>
+ <path>policy access-list</path>
+ </completionHelp>
+ <valueHelp>
+ <format>u32</format>
+ <description>Access-list number</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-4294967295"/>
+ </constraint>
+ </properties>
+ <children>
+ <leafNode name="export">
+ <properties>
+ <help>Filter for outgoing routing update [REQUIRED]</help>
+ <completionHelp>
+ <list>bgp connected kernel rip static</list>
+ </completionHelp>
+ <valueHelp>
+ <format>bgp</format>
+ <description>Filter BGP routes</description>
+ </valueHelp>
+ <valueHelp>
+ <format>connected</format>
+ <description>Filter connected routes</description>
+ </valueHelp>
+ <valueHelp>
+ <format>isis</format>
+ <description>Filter IS-IS routes</description>
+ </valueHelp>
+ <valueHelp>
+ <format>kernel</format>
+ <description>Filter Kernel routes</description>
+ </valueHelp>
+ <valueHelp>
+ <format>rip</format>
+ <description>Filter RIP routes</description>
+ </valueHelp>
+ <valueHelp>
+ <format>static</format>
+ <description>Filter static routes</description>
+ </valueHelp>
+ <constraint>
+ <regex>^(bgp|connected|isis|kernel|rip|static)$</regex>
+ </constraint>
+ <constraintErrorMessage>Must be bgp, connected, kernel, rip, or static</constraintErrorMessage>
+ <multi/>
+ </properties>
+ </leafNode>
+ </children>
+</tagNode>
+<tagNode name="area">
+ <properties>
+ <help>OSPF Area</help>
+ <valueHelp>
+ <format>u32</format>
+ <description>OSPF area in decimal notation</description>
+ </valueHelp>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>OSPF area in dotted decimal notation</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-4294967295"/>
+ <validator name="ip-address"/>
+ </constraint>
+ </properties>
+ <children>
+ <node name="area-type">
+ <properties>
+ <help>Area type</help>
+ </properties>
+ <children>
+ <leafNode name="normal">
+ <properties>
+ <help>Normal OSPF area</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <node name="nssa">
+ <properties>
+ <help>Nssa OSPF area</help>
+ </properties>
+ <children>
+ <leafNode name="default-cost">
+ <properties>
+ <help>Summary-default cost of nssa area</help>
+ <valueHelp>
+ <format>u32:0-16777215</format>
+ <description>Summary default cost</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-16777215"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="no-summary">
+ <properties>
+ <help>Do not inject inter-area routes into stub</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="translate">
+ <properties>
+ <help>Configure NSSA-ABR (default: candidate)</help>
+ <completionHelp>
+ <list>always candidate never</list>
+ </completionHelp>
+ <valueHelp>
+ <format>always</format>
+ <description>NSSA-ABR to always translate</description>
+ </valueHelp>
+ <valueHelp>
+ <format>candidate</format>
+ <description>NSSA-ABR for translate election (default)</description>
+ </valueHelp>
+ <valueHelp>
+ <format>never</format>
+ <description>NSSA-ABR to never translate</description>
+ </valueHelp>
+ <constraint>
+ <regex>^(always|candidate|never)$</regex>
+ </constraint>
+ </properties>
+ <defaultValue>candidate</defaultValue>
+ </leafNode>
+ </children>
+ </node>
+ <node name="stub">
+ <properties>
+ <help>Stub OSPF area</help>
+ </properties>
+ <children>
+ <leafNode name="default-cost">
+ <properties>
+ <help>Summary-default cost of nssa area</help>
+ <valueHelp>
+ <format>u32:0-16777215</format>
+ <description>Summary default cost</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-16777215"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="no-summary">
+ <properties>
+ <help>Do not inject inter-area routes into stub</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ </children>
+ </node>
+ <leafNode name="authentication">
+ <properties>
+ <help>OSPF area authentication type</help>
+ <completionHelp>
+ <list>plaintext-password md5</list>
+ </completionHelp>
+ <valueHelp>
+ <format>plaintext-password</format>
+ <description>Use plain-text authentication</description>
+ </valueHelp>
+ <valueHelp>
+ <format>md5</format>
+ <description>Use md5 authentication</description>
+ </valueHelp>
+ <constraint>
+ <regex>^(plaintext-password|md5)$</regex>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="network">
+ <properties>
+ <help>OSPF network [REQUIRED]</help>
+ <valueHelp>
+ <format>ipv4net</format>
+ <description>OSPF network [REQUIRED]</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-prefix"/>
+ </constraint>
+ <multi/>
+ </properties>
+ </leafNode>
+ <tagNode name="range">
+ <properties>
+ <help>Summarize routes matching prefix (border routers only)</help>
+ <valueHelp>
+ <format>ipv4net</format>
+ <description>Area range prefix</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-prefix"/>
+ </constraint>
+ </properties>
+ <children>
+ <leafNode name="cost">
+ <properties>
+ <help>Metric for this range</help>
+ <valueHelp>
+ <format>u32:0-16777215</format>
+ <description>Metric for this range</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-16777215"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="not-advertise">
+ <properties>
+ <help>Do not advertise this range</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="substitute">
+ <properties>
+ <help>Announce area range as another prefix</help>
+ <valueHelp>
+ <format>ipv4net</format>
+ <description>Announce area range as another prefix</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-prefix"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </tagNode>
+ <leafNode name="shortcut">
+ <properties>
+ <help>Area shortcut mode</help>
+ <completionHelp>
+ <list>default disable enable</list>
+ </completionHelp>
+ <valueHelp>
+ <format>default</format>
+ <description>Set default</description>
+ </valueHelp>
+ <valueHelp>
+ <format>disable</format>
+ <description>Disable shortcutting mode</description>
+ </valueHelp>
+ <valueHelp>
+ <format>enable</format>
+ <description>Enable shortcutting mode</description>
+ </valueHelp>
+ <constraint>
+ <regex>^(default|disable|enable)$</regex>
+ </constraint>
+ </properties>
+ </leafNode>
+ <tagNode name="virtual-link">
+ <properties>
+ <help>Virtual link</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>OSPF area in dotted decimal notation</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-4294967295"/>
+ <validator name="ip-address"/>
+ </constraint>
+ </properties>
+ <children>
+ #include <include/ospf/ospf-authentication.xml.i>
+ #include <include/ospf/ospf-intervals.xml.i>
+ </children>
+ </tagNode>
+ </children>
+</tagNode>
+<node name="auto-cost">
+ <properties>
+ <help>Calculate OSPF interface cost according to bandwidth (default: 100)</help>
+ </properties>
+ <children>
+ <leafNode name="reference-bandwidth">
+ <properties>
+ <help>Reference bandwidth method to assign OSPF cost</help>
+ <valueHelp>
+ <format>u32:1-4294967</format>
+ <description>Reference bandwidth cost in Mbits/sec</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-4294967"/>
+ </constraint>
+ </properties>
+ <defaultValue>100</defaultValue>
+ </leafNode>
+ </children>
+</node>
+<node name="default-information">
+ <properties>
+ <help>Control distribution of default information</help>
+ </properties>
+ <children>
+ <node name="originate">
+ <properties>
+ <help>Distribute a default route</help>
+ </properties>
+ <children>
+ <leafNode name="always">
+ <properties>
+ <help>Always advertise default route</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ #include <include/ospf/ospf-metric.xml.i>
+ #include <include/ospf/ospf-metric-type.xml.i>
+ #include <include/route-map.xml.i>
+ </children>
+ </node>
+ </children>
+</node>
+<leafNode name="default-metric">
+ <properties>
+ <help>Metric of redistributed routes</help>
+ <valueHelp>
+ <format>u32:0-16777214</format>
+ <description>Metric of redistributed routes</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-16777214"/>
+ </constraint>
+ </properties>
+</leafNode>
+<node name="distance">
+ <properties>
+ <help>Administrative distance</help>
+ </properties>
+ <children>
+ #include <include/ospf/ospf-distance-global.xml.i>
+ <node name="ospf">
+ <properties>
+ <help>OSPF administrative distance</help>
+ </properties>
+ <children>
+ #include <include/ospf/ospf-distance-per-protocol.xml.i>
+ </children>
+ </node>
+ </children>
+</node>
+<tagNode name="interface">
+ <properties>
+ <help>Interface related configuration</help>
+ <completionHelp>
+ <script>${vyos_completion_dir}/list_interfaces.py</script>
+ </completionHelp>
+ <valueHelp>
+ <format>txt</format>
+ <description>Interface name</description>
+ </valueHelp>
+ <constraint>
+ <validator name="interface-name"/>
+ </constraint>
+ </properties>
+ <children>
+ #include <include/ospf/ospf-authentication.xml.i>
+ #include <include/ospf/ospf-intervals.xml.i>
+ #include <include/ospf/ospf-interface-common.xml.i>
+ <leafNode name="bandwidth">
+ <properties>
+ <help>Bandwidth of interface (Megabit/sec)</help>
+ <valueHelp>
+ <format>u32:1-100000</format>
+ <description>Bandwidth in Megabit/sec (for calculating OSPF cost)</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-100000"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="hello-multiplier">
+ <properties>
+ <help>Hello multiplier factor</help>
+ <valueHelp>
+ <format>u32:1-10</format>
+ <description>Number of Hellos to send each second</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-10"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="network">
+ <properties>
+ <help>Network type</help>
+ <completionHelp>
+ <list>broadcast non-broadcast point-to-multipoint point-to-point</list>
+ </completionHelp>
+ <valueHelp>
+ <format>broadcast</format>
+ <description>Broadcast network type</description>
+ </valueHelp>
+ <valueHelp>
+ <format>non-broadcast</format>
+ <description>Non-broadcast network type</description>
+ </valueHelp>
+ <valueHelp>
+ <format>point-to-multipoint</format>
+ <description>Point-to-multipoint network type</description>
+ </valueHelp>
+ <valueHelp>
+ <format>point-to-point</format>
+ <description>Point-to-point network type</description>
+ </valueHelp>
+ <constraint>
+ <regex>^(broadcast|non-broadcast|point-to-multipoint|point-to-point)$</regex>
+ </constraint>
+ <constraintErrorMessage>Must be broadcast, non-broadcast, point-to-multipoint or point-to-point</constraintErrorMessage>
+ </properties>
+ </leafNode>
+ </children>
+</tagNode>
+<node name="log-adjacency-changes">
+ <properties>
+ <help>Log changes in adjacency state</help>
+ </properties>
+ <children>
+ <leafNode name="detail">
+ <properties>
+ <help>Log all state changes</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </children>
+</node>
+<node name="max-metric">
+ <properties>
+ <help>OSPF maximum and infinite-distance metric</help>
+ </properties>
+ <children>
+ <node name="router-lsa">
+ <properties>
+ <help>Advertise own Router-LSA with infinite distance (stub router)</help>
+ </properties>
+ <children>
+ <leafNode name="administrative">
+ <properties>
+ <help>Administratively apply, for an indefinite period</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="on-shutdown">
+ <properties>
+ <help>Advertise stub-router prior to full shutdown of OSPF</help>
+ <valueHelp>
+ <format>u32:5-100</format>
+ <description>Time (seconds) to advertise self as stub-router</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 5-100"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="on-startup">
+ <properties>
+ <help>Automatically advertise stub Router-LSA on startup of OSPF</help>
+ <valueHelp>
+ <format>u32:5-86400</format>
+ <description>Time (seconds) to advertise self as stub-router</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 5-86400"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ </children>
+</node>
+<node name="mpls-te">
+ <properties>
+ <help>MultiProtocol Label Switching-Traffic Engineering (MPLS-TE) parameters</help>
+ </properties>
+ <children>
+ <leafNode name="enable">
+ <properties>
+ <help>Enable MPLS-TE functionality</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="router-address">
+ <properties>
+ <help>Stable IP address of the advertising router</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>Stable IP address of the advertising router</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-address"/>
+ </constraint>
+ </properties>
+ <defaultValue>0.0.0.0</defaultValue>
+ </leafNode>
+ </children>
+</node>
+<tagNode name="neighbor">
+ <properties>
+ <help>Specify neighbor router</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>Neighbor IP address</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-address"/>
+ </constraint>
+ </properties>
+ <children>
+ <leafNode name="poll-interval">
+ <properties>
+ <help>Dead neighbor polling interval (default: 60)</help>
+ <valueHelp>
+ <format>u32:1-65535</format>
+ <description>Seconds between dead neighbor polling interval</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-65535"/>
+ </constraint>
+ </properties>
+ <defaultValue>60</defaultValue>
+ </leafNode>
+ <leafNode name="priority">
+ <properties>
+ <help>Neighbor priority in seconds (default: 0)</help>
+ <valueHelp>
+ <format>u32:0-255</format>
+ <description>Neighbor priority</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-255"/>
+ </constraint>
+ </properties>
+ <defaultValue>0</defaultValue>
+ </leafNode>
+ </children>
+</tagNode>
+<node name="parameters">
+ <properties>
+ <help>OSPF specific parameters</help>
+ </properties>
+ <children>
+ <leafNode name="abr-type">
+ <properties>
+ <help>OSPF ABR type (default: cisco)</help>
+ <completionHelp>
+ <list>cisco ibm shortcut standard</list>
+ </completionHelp>
+ <valueHelp>
+ <format>cisco</format>
+ <description>Cisco ABR type (default)</description>
+ </valueHelp>
+ <valueHelp>
+ <format>ibm</format>
+ <description>Ibm ABR type</description>
+ </valueHelp>
+ <valueHelp>
+ <format>shortcut</format>
+ <description>Shortcut ABR type</description>
+ </valueHelp>
+ <valueHelp>
+ <format>standard</format>
+ <description>Standard ABR type</description>
+ </valueHelp>
+ <constraint>
+ <regex>^(cisco|ibm|shortcut|standard)$</regex>
+ </constraint>
+ </properties>
+ <defaultValue>cisco</defaultValue>
+ </leafNode>
+ <leafNode name="opaque-lsa">
+ <properties>
+ <help>Enable the Opaque-LSA capability (rfc2370)</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="rfc1583-compatibility">
+ <properties>
+ <help>Enable rfc1583 criteria for handling AS external routes</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ #include <include/ospf/ospf-router-id.xml.i>
+ </children>
+</node>
+#include <include/routing-passive-interface-xml.i>
+<leafNode name="passive-interface-exclude">
+ <properties>
+ <help>Interface to exclude when using 'passive-interface default'</help>
+ <completionHelp>
+ <script>${vyos_completion_dir}/list_interfaces.py</script>
+ </completionHelp>
+ <valueHelp>
+ <format>txt</format>
+ <description>Interface to exclude when suppressing routing updates</description>
+ </valueHelp>
+ <valueHelp>
+ <format>vlinkN</format>
+ <description>Virtual-link interface to exclude when suppressing routing updates</description>
+ </valueHelp>
+ <constraint>
+ <validator name="interface-name"/>
+ <regex>^(vlink[0-9]+)$</regex>
+ </constraint>
+ <multi/>
+ </properties>
+</leafNode>
+<node name="redistribute">
+ <properties>
+ <help>Redistribute information from another routing protocol</help>
+ </properties>
+ <children>
+ <node name="bgp">
+ <properties>
+ <help>Redistribute BGP routes</help>
+ </properties>
+ <children>
+ #include <include/ospf/ospf-metric.xml.i>
+ #include <include/ospf/ospf-metric-type.xml.i>
+ #include <include/route-map.xml.i>
+ </children>
+ </node>
+ <node name="connected">
+ <properties>
+ <help>Redistribute connected routes</help>
+ </properties>
+ <children>
+ #include <include/ospf/ospf-metric.xml.i>
+ #include <include/ospf/ospf-metric-type.xml.i>
+ #include <include/route-map.xml.i>
+ </children>
+ </node>
+ <node name="isis">
+ <properties>
+ <help>Redistribute IS-IS routes</help>
+ </properties>
+ <children>
+ #include <include/ospf/ospf-metric.xml.i>
+ #include <include/ospf/ospf-metric-type.xml.i>
+ #include <include/route-map.xml.i>
+ </children>
+ </node>
+ <node name="kernel">
+ <properties>
+ <help>Redistribute kernel routes</help>
+ </properties>
+ <children>
+ #include <include/ospf/ospf-metric.xml.i>
+ #include <include/ospf/ospf-metric-type.xml.i>
+ #include <include/route-map.xml.i>
+ </children>
+ </node>
+ <node name="rip">
+ <properties>
+ <help>Redistribute rip routes</help>
+ </properties>
+ <children>
+ #include <include/ospf/ospf-metric.xml.i>
+ #include <include/ospf/ospf-metric-type.xml.i>
+ #include <include/route-map.xml.i>
+ </children>
+ </node>
+ <node name="static">
+ <properties>
+ <help>Redistribute static routes</help>
+ </properties>
+ <children>
+ #include <include/ospf/ospf-metric.xml.i>
+ #include <include/ospf/ospf-metric-type.xml.i>
+ #include <include/route-map.xml.i>
+ </children>
+ </node>
+ </children>
+</node>
+<node name="refresh">
+ <properties>
+ <help>Adjust refresh parameters</help>
+ </properties>
+ <children>
+ <leafNode name="timers">
+ <properties>
+ <help>Refresh timer</help>
+ <valueHelp>
+ <format>u32:10-1800</format>
+ <description>Timer value in seconds</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 10-1800"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+</node>
+#include <include/route-map.xml.i>
+<node name="timers">
+ <properties>
+ <help>Adjust routing timers</help>
+ </properties>
+ <children>
+ <node name="throttle">
+ <properties>
+ <help>Throttling adaptive timers</help>
+ </properties>
+ <children>
+ <node name="spf">
+ <properties>
+ <help>OSPF SPF timers</help>
+ </properties>
+ <children>
+ <leafNode name="delay">
+ <properties>
+ <help>Delay from first change received till SPF calculation (default: 200)</help>
+ <valueHelp>
+ <format>u32:0-600000</format>
+ <description>Delay in milliseconds</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-600000"/>
+ </constraint>
+ </properties>
+ <defaultValue>200</defaultValue>
+ </leafNode>
+ <leafNode name="initial-holdtime">
+ <properties>
+ <help>Initial hold time between consecutive SPF calculations (default: 1000)</help>
+ <valueHelp>
+ <format>u32:0-600000</format>
+ <description>Initial hold time in milliseconds</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-600000"/>
+ </constraint>
+ </properties>
+ <defaultValue>1000</defaultValue>
+ </leafNode>
+ <leafNode name="max-holdtime">
+ <properties>
+ <help>Maximum hold time (default: 10000)</help>
+ <valueHelp>
+ <format>u32:0-600000</format>
+ <description>Max hold time in milliseconds</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-600000"/>
+ </constraint>
+ </properties>
+ <defaultValue>10000</defaultValue>
+ </leafNode>
+ </children>
+ </node>
+ </children>
+ </node>
+ </children>
+</node>
+<!-- include end -->
diff --git a/interface-definitions/include/ospf/ospf-distance-global.xml.i b/interface-definitions/include/ospf/ospf-distance-global.xml.i
new file mode 100644
index 000000000..08cd76cba
--- /dev/null
+++ b/interface-definitions/include/ospf/ospf-distance-global.xml.i
@@ -0,0 +1,14 @@
+<!-- include start from ospf/ospf-distance-global.xml.i -->
+<leafNode name="global">
+ <properties>
+ <help>Administrative distance</help>
+ <valueHelp>
+ <format>u32:1-255</format>
+ <description>Administrative distance</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-255"/>
+ </constraint>
+ </properties>
+</leafNode>
+<!-- include end -->
diff --git a/interface-definitions/include/ospf/ospf-distance-per-protocol.xml.i b/interface-definitions/include/ospf/ospf-distance-per-protocol.xml.i
new file mode 100644
index 000000000..d2c4b8b52
--- /dev/null
+++ b/interface-definitions/include/ospf/ospf-distance-per-protocol.xml.i
@@ -0,0 +1,38 @@
+<!-- include start from ospf/ospf-distance-per-protocol.xml.i -->
+<leafNode name="external">
+ <properties>
+ <help>Distance for external routes</help>
+ <valueHelp>
+ <format>u32:1-255</format>
+ <description>Distance for external routes</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-255"/>
+ </constraint>
+ </properties>
+</leafNode>
+<leafNode name="inter-area">
+ <properties>
+ <help>Distance for inter-area routes</help>
+ <valueHelp>
+ <format>u32:1-255</format>
+ <description>Distance for inter-area routes</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-255"/>
+ </constraint>
+ </properties>
+</leafNode>
+<leafNode name="intra-area">
+ <properties>
+ <help>Distance for intra-area routes</help>
+ <valueHelp>
+ <format>u32:1-255</format>
+ <description>Distance for intra-area routes</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-255"/>
+ </constraint>
+ </properties>
+</leafNode>
+<!-- include end -->
diff --git a/interface-definitions/include/ospf-interface-common.xml.i b/interface-definitions/include/ospf/ospf-interface-common.xml.i
index c3493faa3..39e90482c 100644
--- a/interface-definitions/include/ospf-interface-common.xml.i
+++ b/interface-definitions/include/ospf/ospf-interface-common.xml.i
@@ -1,10 +1,5 @@
-<!-- included start from ospf-interface-common.xml.i -->
-<leafNode name="bfd">
- <properties>
- <help>Enable Bidirectional Forwarding Detection (BFD) support</help>
- <valueless/>
- </properties>
-</leafNode>
+<!-- include start from ospf/ospf-interface-common.xml.i -->
+#include <include/bfd.xml.i>
<leafNode name="cost">
<properties>
<help>Interface cost</help>
@@ -36,4 +31,4 @@
</properties>
<defaultValue>1</defaultValue>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/ospf-intervals.xml.i b/interface-definitions/include/ospf/ospf-intervals.xml.i
index e532bd14b..fe220eceb 100644
--- a/interface-definitions/include/ospf-intervals.xml.i
+++ b/interface-definitions/include/ospf/ospf-intervals.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from ospf-intervals.xml.i -->
+<!-- include start from ospf/ospf-intervals.xml.i -->
<leafNode name="dead-interval">
<properties>
<help>Interval after which a neighbor is declared dead (default: 40)</help>
@@ -51,4 +51,4 @@
</properties>
<defaultValue>1</defaultValue>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/ospf-metric-type.xml.i b/interface-definitions/include/ospf/ospf-metric-type.xml.i
index 50f11960c..1e982c4bc 100644
--- a/interface-definitions/include/ospf-metric-type.xml.i
+++ b/interface-definitions/include/ospf/ospf-metric-type.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from ospf-metric-type.xml.i -->
+<!-- include start from ospf/ospf-metric-type.xml.i -->
<leafNode name="metric-type">
<properties>
<help>OSPF metric type for default routes (default: 2)</help>
@@ -12,4 +12,4 @@
</properties>
<defaultValue>2</defaultValue>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/ospf-metric.xml.i b/interface-definitions/include/ospf/ospf-metric.xml.i
index 3ce12e877..125aedea7 100644
--- a/interface-definitions/include/ospf-metric.xml.i
+++ b/interface-definitions/include/ospf/ospf-metric.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from ospf-metric.xml.i -->
+<!-- include start from ospf/ospf-metric.xml.i -->
<leafNode name="metric">
<properties>
<help>OSPF default metric</help>
@@ -11,4 +11,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/ospf/ospf-router-id.xml.i b/interface-definitions/include/ospf/ospf-router-id.xml.i
new file mode 100644
index 000000000..5dbb52a36
--- /dev/null
+++ b/interface-definitions/include/ospf/ospf-router-id.xml.i
@@ -0,0 +1,14 @@
+<!-- include start from ospf/ospf-router-id.xml.i -->
+<leafNode name="router-id">
+ <properties>
+ <help>Override the default router identifier</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>Override the default router identifier</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-address"/>
+ </constraint>
+ </properties>
+</leafNode>
+<!-- include end -->
diff --git a/interface-definitions/include/policy-list-action.xml.i b/interface-definitions/include/policy-list-action.xml.i
new file mode 100644
index 000000000..fddbd5a98
--- /dev/null
+++ b/interface-definitions/include/policy-list-action.xml.i
@@ -0,0 +1,21 @@
+<!-- included start from policy-list-action.xml.i -->
+<leafNode name="action">
+ <properties>
+ <help>Action to take on entries matching this rule [REQUIRED]</help>
+ <completionHelp>
+ <list>permit deny</list>
+ </completionHelp>
+ <valueHelp>
+ <format>permit</format>
+ <description>Permit matching entries</description>
+ </valueHelp>
+ <valueHelp>
+ <format>deny</format>
+ <description>Deny matching entries</description>
+ </valueHelp>
+ <constraint>
+ <regex>^(permit|deny)$</regex>
+ </constraint>
+ </properties>
+</leafNode>
+<!-- included end -->
diff --git a/interface-definitions/include/policy-list-description.xml.i b/interface-definitions/include/policy-list-description.xml.i
new file mode 100644
index 000000000..a50278729
--- /dev/null
+++ b/interface-definitions/include/policy-list-description.xml.i
@@ -0,0 +1,11 @@
+<!-- included start from policy-list-description.xml.i -->
+<leafNode name="description">
+ <properties>
+ <help>Description for this policy</help>
+ <valueHelp>
+ <format>txt</format>
+ <description>Description for this policy</description>
+ </valueHelp>
+ </properties>
+</leafNode>
+<!-- included end -->
diff --git a/interface-definitions/include/policy-list-rule-description.xml.i b/interface-definitions/include/policy-list-rule-description.xml.i
new file mode 100644
index 000000000..e22fb7c28
--- /dev/null
+++ b/interface-definitions/include/policy-list-rule-description.xml.i
@@ -0,0 +1,11 @@
+<!-- included start from policy-list-rule-description.xml.i -->
+<leafNode name="description">
+ <properties>
+ <help>Description for this rule</help>
+ <valueHelp>
+ <format>txt</format>
+ <description>Description for this rule</description>
+ </valueHelp>
+ </properties>
+</leafNode>
+<!-- included end -->
diff --git a/interface-definitions/include/port-number.xml.i b/interface-definitions/include/port-number.xml.i
index 81c192628..b62aef32b 100644
--- a/interface-definitions/include/port-number.xml.i
+++ b/interface-definitions/include/port-number.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from port-number.xml.i -->
+<!-- include start from port-number.xml.i -->
<leafNode name="port">
<properties>
<help>Port number used by connection</help>
@@ -11,4 +11,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/radius-server-ipv4-ipv6.xml.i b/interface-definitions/include/radius-server-ipv4-ipv6.xml.i
index c57d39b6b..5b12bec62 100644
--- a/interface-definitions/include/radius-server-ipv4-ipv6.xml.i
+++ b/interface-definitions/include/radius-server-ipv4-ipv6.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from radius-server-ipv4-ipv6.xml.i -->
+<!-- include start from radius-server-ipv4-ipv6.xml.i -->
<node name="radius">
<properties>
<help>RADIUS based user authentication</help>
@@ -49,4 +49,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/radius-server-ipv4.xml.i b/interface-definitions/include/radius-server-ipv4.xml.i
index 15a421b9a..ab4c8e10e 100644
--- a/interface-definitions/include/radius-server-ipv4.xml.i
+++ b/interface-definitions/include/radius-server-ipv4.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from radius-server-ipv4.xml.i -->
+<!-- include start from radius-server-ipv4.xml.i -->
<node name="radius">
<properties>
<help>RADIUS based user authentication</help>
@@ -24,4 +24,4 @@
</tagNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/radius-server-key.xml.i b/interface-definitions/include/radius-server-key.xml.i
index 32a01b402..c6301646b 100644
--- a/interface-definitions/include/radius-server-key.xml.i
+++ b/interface-definitions/include/radius-server-key.xml.i
@@ -1,7 +1,7 @@
-<!-- included start from radius-server-key.xml.i -->
+<!-- include start from radius-server-key.xml.i -->
<leafNode name="key">
<properties>
<help>Shared secret key</help>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/radius-server-port.xml.i b/interface-definitions/include/radius-server-port.xml.i
index 71b6bddb7..4e5d906bc 100644
--- a/interface-definitions/include/radius-server-port.xml.i
+++ b/interface-definitions/include/radius-server-port.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from radius-server-port.xml.i -->
+<!-- include start from radius-server-port.xml.i -->
<leafNode name="port">
<properties>
<help>Authentication port</help>
@@ -12,4 +12,4 @@
</properties>
<defaultValue>1812</defaultValue>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/rip-access-list.xml.i b/interface-definitions/include/rip/rip-access-list.xml.i
index 0db6863e5..00ee9b736 100644
--- a/interface-definitions/include/rip-access-list.xml.i
+++ b/interface-definitions/include/rip/rip-access-list.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from rip-access-list.xml.i -->
+<!-- include start from rip/rip-access-list.xml.i -->
<node name="access-list">
<properties>
<help>Access-list</help>
@@ -36,4 +36,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/rip-access-list6.xml.i b/interface-definitions/include/rip/rip-access-list6.xml.i
index 6a8a37607..9e4298bc0 100644
--- a/interface-definitions/include/rip-access-list6.xml.i
+++ b/interface-definitions/include/rip/rip-access-list6.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from rip-access-list.xml.i -->
+<!-- include start from rip/rip-access-list.xml.i -->
<node name="access-list">
<properties>
<help>Access-list</help>
@@ -36,4 +36,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/rip-default-information.xml.i b/interface-definitions/include/rip/rip-default-information.xml.i
index 22a2f6ac7..28c540c26 100644
--- a/interface-definitions/include/rip-default-information.xml.i
+++ b/interface-definitions/include/rip/rip-default-information.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from rip-default-information.xml.i -->
+<!-- include start from rip/rip-default-information.xml.i -->
<node name="default-information">
<properties>
<help>Control distribution of default route</help>
@@ -12,4 +12,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/rip-default-metric.xml.i b/interface-definitions/include/rip/rip-default-metric.xml.i
index a5e6016d6..297af5af8 100644
--- a/interface-definitions/include/rip-default-metric.xml.i
+++ b/interface-definitions/include/rip/rip-default-metric.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from rip-default-metric.xml.i -->
+<!-- include start from rip/rip-default-metric.xml.i -->
<leafNode name="default-metric">
<properties>
<help>Metric of redistributed routes</help>
@@ -11,4 +11,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/rip-interface.xml.i b/interface-definitions/include/rip/rip-interface.xml.i
index 6279c16c8..dd3bddd4f 100644
--- a/interface-definitions/include/rip-interface.xml.i
+++ b/interface-definitions/include/rip/rip-interface.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from rip-interface.xml.i -->
+<!-- include start from rip/rip-interface.xml.i -->
<tagNode name="interface">
<properties>
<help>Interface name</help>
@@ -35,4 +35,4 @@
</node>
</children>
</tagNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/rip-prefix-list.xml.i b/interface-definitions/include/rip/rip-prefix-list.xml.i
index 58969a86b..2569a2a09 100644
--- a/interface-definitions/include/rip-prefix-list.xml.i
+++ b/interface-definitions/include/rip/rip-prefix-list.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from rip-prefix-list.xml.i -->
+<!-- include start from rip/rip-prefix-list.xml.i -->
<node name="prefix-list">
<properties>
<help>Prefix-list</help>
@@ -30,4 +30,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/rip-prefix-list6.xml.i b/interface-definitions/include/rip/rip-prefix-list6.xml.i
index f73f77d05..fcf1499e0 100644
--- a/interface-definitions/include/rip-prefix-list6.xml.i
+++ b/interface-definitions/include/rip/rip-prefix-list6.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from rip-prefix-list.xml.i -->
+<!-- include start from rip/rip-prefix-list.xml.i -->
<node name="prefix-list">
<properties>
<help>Prefix-list</help>
@@ -30,4 +30,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/rip-redistribute.xml.i b/interface-definitions/include/rip/rip-redistribute.xml.i
index c7b9d2c09..d7a79b007 100644
--- a/interface-definitions/include/rip-redistribute.xml.i
+++ b/interface-definitions/include/rip/rip-redistribute.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from rip-redistribute.xml.i -->
+<!-- include start from rip/rip-redistribute.xml.i -->
<leafNode name="metric">
<properties>
<help>Metric for redistributed routes</help>
@@ -11,5 +11,5 @@
</constraint>
</properties>
</leafNode>
-#include <include/ospf-route-map.xml.i>
-<!-- included end -->
+#include <include/route-map.xml.i>
+<!-- include end -->
diff --git a/interface-definitions/include/rip-timers.xml.i b/interface-definitions/include/rip/rip-timers.xml.i
index 5ba19bb06..3aaaf8e65 100644
--- a/interface-definitions/include/rip-timers.xml.i
+++ b/interface-definitions/include/rip/rip-timers.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from rip-timers.xml.i -->
+<!-- include start from rip/rip-timers.xml.i -->
<node name="timers">
<properties>
<help>RIPng timer values</help>
@@ -45,4 +45,4 @@
</leafNode>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/ospf-route-map.xml.i b/interface-definitions/include/route-map.xml.i
index 943a477c0..5a1c137b9 100644
--- a/interface-definitions/include/ospf-route-map.xml.i
+++ b/interface-definitions/include/route-map.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from ospf-route-map.xml.i -->
+<!-- include start from route-map.xml.i -->
<leafNode name="route-map">
<properties>
<help>Route map reference</help>
@@ -11,4 +11,4 @@
</completionHelp>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/source-address-ipv4-ipv6.xml.i b/interface-definitions/include/source-address-ipv4-ipv6.xml.i
index 93cfd7c63..af3f9bb68 100644
--- a/interface-definitions/include/source-address-ipv4-ipv6.xml.i
+++ b/interface-definitions/include/source-address-ipv4-ipv6.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from source-address-ipv4-ipv6.xml.i -->
+<!-- include start from source-address-ipv4-ipv6.xml.i -->
<leafNode name="source-address">
<properties>
<help>Source IP address used to initiate connection</help>
@@ -18,4 +18,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/source-address-ipv4.xml.i b/interface-definitions/include/source-address-ipv4.xml.i
index 2dff2c65e..86235df61 100644
--- a/interface-definitions/include/source-address-ipv4.xml.i
+++ b/interface-definitions/include/source-address-ipv4.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from source-address-ipv4.xml.i -->
+<!-- include start from source-address-ipv4.xml.i -->
<leafNode name="source-address">
<properties>
<help>IPv4 source address used to initiiate connection</help>
@@ -14,4 +14,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/source-interface-ethernet.xml.i b/interface-definitions/include/source-interface-ethernet.xml.i
index d641f3cb1..ee04f2cd5 100644
--- a/interface-definitions/include/source-interface-ethernet.xml.i
+++ b/interface-definitions/include/source-interface-ethernet.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from source-interface-ethernet.xml.i -->
+<!-- include start from source-interface-ethernet.xml.i -->
<leafNode name="source-interface">
<properties>
<help>Physical interface the traffic will go through</help>
@@ -11,4 +11,4 @@
</completionHelp>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/source-interface.xml.i b/interface-definitions/include/source-interface.xml.i
index 797206430..a9c2a0f9d 100644
--- a/interface-definitions/include/source-interface.xml.i
+++ b/interface-definitions/include/source-interface.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from source-interface.xml.i -->
+<!-- include start from source-interface.xml.i -->
<leafNode name="source-interface">
<properties>
<help>Interface used to establish connection</help>
@@ -14,4 +14,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/static-route-blackhole.xml.i b/interface-definitions/include/static/static-route-blackhole.xml.i
index d0a0c2079..f2ad23e69 100644
--- a/interface-definitions/include/static-route-blackhole.xml.i
+++ b/interface-definitions/include/static/static-route-blackhole.xml.i
@@ -1,10 +1,10 @@
-<!-- included start from static-route-blackhole.xml.i -->
+<!-- include start from static/static-route-blackhole.xml.i -->
<node name="blackhole">
<properties>
<help>Silently discard packets when matched</help>
</properties>
<children>
- #include <include/static-route-distance.xml.i>
+ #include <include/static/static-route-distance.xml.i>
</children>
</node>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/static-route-distance.xml.i b/interface-definitions/include/static/static-route-distance.xml.i
index d6c0d3d82..a651b98d7 100644
--- a/interface-definitions/include/static-route-distance.xml.i
+++ b/interface-definitions/include/static/static-route-distance.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from static-route-distance.xml.i -->
+<!-- include start from static/static-route-distance.xml.i -->
<leafNode name="distance">
<properties>
<help>Distance for this route</help>
@@ -11,4 +11,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/static-route-interface.xml.i b/interface-definitions/include/static/static-route-interface.xml.i
index 0f10837df..ed4f455e5 100644
--- a/interface-definitions/include/static-route-interface.xml.i
+++ b/interface-definitions/include/static/static-route-interface.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from static-route-interface.xml.i -->
+<!-- include start from static/static-route-interface.xml.i -->
<leafNode name="interface">
<properties>
<help>Gateway interface name</help>
@@ -14,4 +14,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/static-route-map.xml.i b/interface-definitions/include/static/static-route-map.xml.i
index 25542b8b1..af825e043 100644
--- a/interface-definitions/include/static-route-map.xml.i
+++ b/interface-definitions/include/static/static-route-map.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from static-route-map.xml.i -->
+<!-- include start from static/static-route-map.xml.i -->
<leafNode name="route-map">
<properties>
<help>Filter routes installed in local route map</help>
@@ -7,4 +7,4 @@
</completionHelp>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/static-route-vrf.xml.i b/interface-definitions/include/static/static-route-vrf.xml.i
index 70f8b0be8..69aba253c 100644
--- a/interface-definitions/include/static-route-vrf.xml.i
+++ b/interface-definitions/include/static/static-route-vrf.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from static-route-vrf.xml.i -->
+<!-- include start from static/static-route-vrf.xml.i -->
<leafNode name="vrf">
<properties>
<help>VRF to leak route</help>
@@ -16,4 +16,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/static-route.xml.i b/interface-definitions/include/static/static-route.xml.i
index 21fcbcd3f..254ea3163 100644
--- a/interface-definitions/include/static-route.xml.i
+++ b/interface-definitions/include/static/static-route.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from static-route.xml.i -->
+<!-- include start from static/static-route.xml.i -->
<tagNode name="route">
<properties>
<help>VRF static IPv4 route</help>
@@ -16,7 +16,7 @@
<help>Silently discard pkts when matched</help>
</properties>
<children>
- #include <include/static-route-distance.xml.i>
+ #include <include/static/static-route-distance.xml.i>
<leafNode name="tag">
<properties>
<help>Tag value for this route</help>
@@ -62,8 +62,8 @@
</properties>
<children>
#include <include/generic-disable-node.xml.i>
- #include <include/static-route-distance.xml.i>
- #include <include/static-route-vrf.xml.i>
+ #include <include/static/static-route-distance.xml.i>
+ #include <include/static/static-route-vrf.xml.i>
</children>
</tagNode>
<tagNode name="next-hop">
@@ -79,12 +79,12 @@
</properties>
<children>
#include <include/generic-disable-node.xml.i>
- #include <include/static-route-distance.xml.i>
- #include <include/static-route-interface.xml.i>
- #include <include/static-route-vrf.xml.i>
+ #include <include/static/static-route-distance.xml.i>
+ #include <include/static/static-route-interface.xml.i>
+ #include <include/static/static-route-vrf.xml.i>
</children>
</tagNode>
</children>
</tagNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/static-route6.xml.i b/interface-definitions/include/static/static-route6.xml.i
index fcf97cd03..0ea995588 100644
--- a/interface-definitions/include/static-route6.xml.i
+++ b/interface-definitions/include/static/static-route6.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from static-route6.xml.i -->
+<!-- include start from static/static-route6.xml.i -->
<tagNode name="route6">
<properties>
<help>VRF static IPv6 route</help>
@@ -16,7 +16,7 @@
<help>Silently discard pkts when matched</help>
</properties>
<children>
- #include <include/static-route-distance.xml.i>
+ #include <include/static/static-route-distance.xml.i>
<leafNode name="tag">
<properties>
<help>Tag value for this route</help>
@@ -47,8 +47,8 @@
</properties>
<children>
#include <include/generic-disable-node.xml.i>
- #include <include/static-route-distance.xml.i>
- #include <include/static-route-vrf.xml.i>
+ #include <include/static/static-route-distance.xml.i>
+ #include <include/static/static-route-vrf.xml.i>
</children>
</tagNode>
<tagNode name="next-hop">
@@ -64,12 +64,12 @@
</properties>
<children>
#include <include/generic-disable-node.xml.i>
- #include <include/static-route-distance.xml.i>
- #include <include/static-route-interface.xml.i>
- #include <include/static-route-vrf.xml.i>
+ #include <include/static/static-route-distance.xml.i>
+ #include <include/static/static-route-interface.xml.i>
+ #include <include/static/static-route-vrf.xml.i>
</children>
</tagNode>
</children>
</tagNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/vpn-ipsec-encryption.xml.i b/interface-definitions/include/vpn-ipsec-encryption.xml.i
index 1c1d728fc..041ba9902 100644
--- a/interface-definitions/include/vpn-ipsec-encryption.xml.i
+++ b/interface-definitions/include/vpn-ipsec-encryption.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from vpn-ipsec-encryption.xml.i -->
+<!-- include start from vpn-ipsec-encryption.xml.i -->
<leafNode name="encryption">
<properties>
<help>Encryption algorithm</help>
@@ -230,4 +230,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/vpn-ipsec-hash.xml.i b/interface-definitions/include/vpn-ipsec-hash.xml.i
index ca5976d27..93d57b622 100644
--- a/interface-definitions/include/vpn-ipsec-hash.xml.i
+++ b/interface-definitions/include/vpn-ipsec-hash.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from pn-ipsec-hash.xml.i -->
+<!-- include start from pn-ipsec-hash.xml.i -->
<leafNode name="hash">
<properties>
<help>Hash algorithm</help>
@@ -62,4 +62,4 @@
</constraint>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/include/webproxy-url-filtering.xml.i b/interface-definitions/include/webproxy-url-filtering.xml.i
index 07db0948f..265bbff94 100644
--- a/interface-definitions/include/webproxy-url-filtering.xml.i
+++ b/interface-definitions/include/webproxy-url-filtering.xml.i
@@ -1,4 +1,4 @@
-<!-- included start from webproxy-url-filtering.xml.i -->
+<!-- include start from webproxy-url-filtering.xml.i -->
<leafNode name="allow-category">
<properties>
<help>Category to allow</help>
@@ -116,4 +116,4 @@
<multi/>
</properties>
</leafNode>
-<!-- included end -->
+<!-- include end -->
diff --git a/interface-definitions/interfaces-bonding.xml.in b/interface-definitions/interfaces-bonding.xml.in
index f6ceefcaa..4382433b2 100644
--- a/interface-definitions/interfaces-bonding.xml.in
+++ b/interface-definitions/interfaces-bonding.xml.in
@@ -16,7 +16,7 @@
</valueHelp>
</properties>
<children>
- #include <include/address-ipv4-ipv6-dhcp.xml.i>
+ #include <include/interface/address-ipv4-ipv6-dhcp.xml.i>
<node name="arp-monitor">
<properties>
<help>ARP link monitoring parameters</help>
@@ -49,13 +49,13 @@
</leafNode>
</children>
</node>
- #include <include/interface-description.xml.i>
- #include <include/dhcp-options.xml.i>
- #include <include/dhcpv6-options.xml.i>
- #include <include/interface-disable-link-detect.xml.i>
- #include <include/interface-disable.xml.i>
- #include <include/interface-vrf.xml.i>
- #include <include/interface-mirror.xml.i>
+ #include <include/interface/interface-description.xml.i>
+ #include <include/interface/dhcp-options.xml.i>
+ #include <include/interface/dhcpv6-options.xml.i>
+ #include <include/interface/interface-disable-link-detect.xml.i>
+ #include <include/interface/interface-disable.xml.i>
+ #include <include/interface/interface-vrf.xml.i>
+ #include <include/interface/interface-mirror.xml.i>
<leafNode name="hash-policy">
<properties>
<help>Bonding transmit hash policy</help>
@@ -81,9 +81,9 @@
</properties>
<defaultValue>layer2</defaultValue>
</leafNode>
- #include <include/interface-ipv4-options.xml.i>
- #include <include/interface-ipv6-options.xml.i>
- #include <include/interface-mac.xml.i>
+ #include <include/interface/interface-ipv4-options.xml.i>
+ #include <include/interface/interface-ipv6-options.xml.i>
+ #include <include/interface/interface-mac.xml.i>
<leafNode name="min-links">
<properties>
<help>Minimum number of member interfaces required up before enabling bond</help>
@@ -154,7 +154,7 @@
</leafNode>
</children>
</node>
- #include <include/interface-mtu-68-16000.xml.i>
+ #include <include/interface/interface-mtu-68-16000.xml.i>
<leafNode name="primary">
<properties>
<help>Primary device interface</help>
@@ -163,9 +163,9 @@
</completionHelp>
</properties>
</leafNode>
- #include <include/vif-s.xml.i>
- #include <include/vif.xml.i>
- #include <include/interface-xdp.xml.i>
+ #include <include/interface/vif-s.xml.i>
+ #include <include/interface/vif.xml.i>
+ #include <include/interface/interface-xdp.xml.i>
</children>
</tagNode>
</children>
diff --git a/interface-definitions/interfaces-bridge.xml.in b/interface-definitions/interfaces-bridge.xml.in
index 63c543f33..1af002142 100644
--- a/interface-definitions/interfaces-bridge.xml.in
+++ b/interface-definitions/interfaces-bridge.xml.in
@@ -16,7 +16,7 @@
</valueHelp>
</properties>
<children>
- #include <include/address-ipv4-ipv6-dhcp.xml.i>
+ #include <include/interface/address-ipv4-ipv6-dhcp.xml.i>
<leafNode name="aging">
<properties>
<help>MAC address aging interval</help>
@@ -34,13 +34,13 @@
</properties>
<defaultValue>300</defaultValue>
</leafNode>
- #include <include/interface-description.xml.i>
- #include <include/dhcp-options.xml.i>
- #include <include/dhcpv6-options.xml.i>
- #include <include/interface-disable-link-detect.xml.i>
- #include <include/interface-disable.xml.i>
- #include <include/interface-vrf.xml.i>
- #include <include/interface-mtu-68-16000.xml.i>
+ #include <include/interface/interface-description.xml.i>
+ #include <include/interface/dhcp-options.xml.i>
+ #include <include/interface/dhcpv6-options.xml.i>
+ #include <include/interface/interface-disable-link-detect.xml.i>
+ #include <include/interface/interface-disable.xml.i>
+ #include <include/interface/interface-vrf.xml.i>
+ #include <include/interface/interface-mtu-68-16000.xml.i>
<leafNode name="forwarding-delay">
<properties>
<help>Forwarding delay</help>
@@ -82,10 +82,10 @@
</leafNode>
</children>
</node>
- #include <include/interface-ipv4-options.xml.i>
- #include <include/interface-ipv6-options.xml.i>
- #include <include/interface-mac.xml.i>
- #include <include/interface-mirror.xml.i>
+ #include <include/interface/interface-ipv4-options.xml.i>
+ #include <include/interface/interface-ipv6-options.xml.i>
+ #include <include/interface/interface-mac.xml.i>
+ #include <include/interface/interface-mirror.xml.i>
<leafNode name="enable-vlan">
<properties>
<help>Enable VLAN aware bridge</help>
@@ -178,6 +178,12 @@
</properties>
<defaultValue>32</defaultValue>
</leafNode>
+ <leafNode name="isolated">
+ <properties>
+ <help>Port is isolated (also known as Private-VLAN)</help>
+ <valueless/>
+ </properties>
+ </leafNode>
</children>
</tagNode>
</children>
@@ -202,7 +208,7 @@
<valueless/>
</properties>
</leafNode>
- #include <include/vif.xml.i>
+ #include <include/interface/vif.xml.i>
</children>
</tagNode>
</children>
diff --git a/interface-definitions/interfaces-dummy.xml.in b/interface-definitions/interfaces-dummy.xml.in
index 54de43c7a..84c6903c7 100644
--- a/interface-definitions/interfaces-dummy.xml.in
+++ b/interface-definitions/interfaces-dummy.xml.in
@@ -16,18 +16,18 @@
</valueHelp>
</properties>
<children>
- #include <include/address-ipv4-ipv6.xml.i>
- #include <include/interface-description.xml.i>
- #include <include/interface-disable.xml.i>
+ #include <include/interface/address-ipv4-ipv6.xml.i>
+ #include <include/interface/interface-description.xml.i>
+ #include <include/interface/interface-disable.xml.i>
<node name="ip">
<properties>
<help>IPv4 routing parameters</help>
</properties>
<children>
- #include <include/interface-source-validation.xml.i>
+ #include <include/interface/interface-source-validation.xml.i>
</children>
</node>
- #include <include/interface-vrf.xml.i>
+ #include <include/interface/interface-vrf.xml.i>
</children>
</tagNode>
</children>
diff --git a/interface-definitions/interfaces-erspan.xml.in b/interface-definitions/interfaces-erspan.xml.in
index 2394d3534..769899415 100644
--- a/interface-definitions/interfaces-erspan.xml.in
+++ b/interface-definitions/interfaces-erspan.xml.in
@@ -16,12 +16,12 @@
</valueHelp>
</properties>
<children>
- #include <include/interface-description.xml.i>
- #include <include/interface-disable.xml.i>
- #include <include/interface-disable-link-detect.xml.i>
- #include <include/interface-mtu-64-8024.xml.i>
+ #include <include/interface/interface-description.xml.i>
+ #include <include/interface/interface-disable.xml.i>
+ #include <include/interface/interface-disable-link-detect.xml.i>
+ #include <include/interface/interface-mtu-64-8024.xml.i>
#include <include/source-address-ipv4-ipv6.xml.i>
- #include <include/tunnel-remote.xml.i>
+ #include <include/interface/tunnel-remote.xml.i>
<leafNode name="encapsulation">
<properties>
<help>Encapsulation of this tunnel interface</help>
@@ -52,9 +52,9 @@
<help>IPv4 specific tunnel parameters</help>
</properties>
<children>
- #include <include/interface-parameters-key.xml.i>
- #include <include/interface-parameters-tos.xml.i>
- #include <include/interface-parameters-ttl.xml.i>
+ #include <include/interface/interface-parameters-key.xml.i>
+ #include <include/interface/interface-parameters-tos.xml.i>
+ #include <include/interface/interface-parameters-ttl.xml.i>
</children>
</node>
<leafNode name="version">
diff --git a/interface-definitions/interfaces-ethernet.xml.in b/interface-definitions/interfaces-ethernet.xml.in
index be44072a6..f00f65364 100644
--- a/interface-definitions/interfaces-ethernet.xml.in
+++ b/interface-definitions/interfaces-ethernet.xml.in
@@ -16,18 +16,18 @@
</valueHelp>
</properties>
<children>
- #include <include/address-ipv4-ipv6-dhcp.xml.i>
- #include <include/interface-description.xml.i>
- #include <include/dhcp-options.xml.i>
- #include <include/dhcpv6-options.xml.i>
+ #include <include/interface/address-ipv4-ipv6-dhcp.xml.i>
+ #include <include/interface/interface-description.xml.i>
+ #include <include/interface/dhcp-options.xml.i>
+ #include <include/interface/dhcpv6-options.xml.i>
<leafNode name="disable-flow-control">
<properties>
<help>Disable Ethernet flow control (pause frames)</help>
<valueless/>
</properties>
</leafNode>
- #include <include/interface-disable-link-detect.xml.i>
- #include <include/interface-disable.xml.i>
+ #include <include/interface/interface-disable-link-detect.xml.i>
+ #include <include/interface/interface-disable.xml.i>
<leafNode name="duplex">
<properties>
<help>Duplex mode</help>
@@ -53,13 +53,13 @@
</properties>
<defaultValue>auto</defaultValue>
</leafNode>
- #include <include/interface-eapol.xml.i>
- #include <include/interface-hw-id.xml.i>
- #include <include/interface-ipv4-options.xml.i>
- #include <include/interface-ipv6-options.xml.i>
- #include <include/interface-mac.xml.i>
- #include <include/interface-mtu-68-16000.xml.i>
- #include <include/interface-mirror.xml.i>
+ #include <include/interface/interface-eapol.xml.i>
+ #include <include/interface/interface-hw-id.xml.i>
+ #include <include/interface/interface-ipv4-options.xml.i>
+ #include <include/interface/interface-ipv6-options.xml.i>
+ #include <include/interface/interface-mac.xml.i>
+ #include <include/interface/interface-mtu-68-16000.xml.i>
+ #include <include/interface/interface-mirror.xml.i>
<node name="offload">
<properties>
<help>Configurable offload options</help>
@@ -191,10 +191,10 @@
</leafNode>
</children>
</node>
- #include <include/vif-s.xml.i>
- #include <include/vif.xml.i>
- #include <include/interface-vrf.xml.i>
- #include <include/interface-xdp.xml.i>
+ #include <include/interface/vif-s.xml.i>
+ #include <include/interface/vif.xml.i>
+ #include <include/interface/interface-vrf.xml.i>
+ #include <include/interface/interface-xdp.xml.i>
</children>
</tagNode>
</children>
diff --git a/interface-definitions/interfaces-geneve.xml.in b/interface-definitions/interfaces-geneve.xml.in
index 25308c8ef..bdcbc3f5e 100644
--- a/interface-definitions/interfaces-geneve.xml.in
+++ b/interface-definitions/interfaces-geneve.xml.in
@@ -16,13 +16,13 @@
</valueHelp>
</properties>
<children>
- #include <include/address-ipv4-ipv6.xml.i>
- #include <include/interface-description.xml.i>
- #include <include/interface-disable.xml.i>
- #include <include/interface-ipv4-options.xml.i>
- #include <include/interface-ipv6-options.xml.i>
- #include <include/interface-mac.xml.i>
- #include <include/interface-mtu-1450-16000.xml.i>
+ #include <include/interface/address-ipv4-ipv6.xml.i>
+ #include <include/interface/interface-description.xml.i>
+ #include <include/interface/interface-disable.xml.i>
+ #include <include/interface/interface-ipv4-options.xml.i>
+ #include <include/interface/interface-ipv6-options.xml.i>
+ #include <include/interface/interface-mac.xml.i>
+ #include <include/interface/interface-mtu-1450-16000.xml.i>
<node name="parameters">
<properties>
<help>GENEVE tunnel parameters</help>
@@ -33,9 +33,9 @@
<help>IPv4 specific tunnel parameters</help>
</properties>
<children>
- #include <include/interface-parameters-dont-fragment.xml.i>
- #include <include/interface-parameters-tos.xml.i>
- #include <include/interface-parameters-ttl.xml.i>
+ #include <include/interface/interface-parameters-dont-fragment.xml.i>
+ #include <include/interface/interface-parameters-tos.xml.i>
+ #include <include/interface/interface-parameters-ttl.xml.i>
</children>
</node>
<node name="ipv6">
@@ -43,12 +43,12 @@
<help>IPv6 specific tunnel parameters</help>
</properties>
<children>
- #include <include/interface-parameters-flowlabel.xml.i>
+ #include <include/interface/interface-parameters-flowlabel.xml.i>
</children>
</node>
</children>
</node>
- #include <include/tunnel-remote.xml.i>
+ #include <include/interface/tunnel-remote.xml.i>
#include <include/vni.xml.i>
</children>
</tagNode>
diff --git a/interface-definitions/interfaces-l2tpv3.xml.in b/interface-definitions/interfaces-l2tpv3.xml.in
index 68ac15861..831b9b47a 100644
--- a/interface-definitions/interfaces-l2tpv3.xml.in
+++ b/interface-definitions/interfaces-l2tpv3.xml.in
@@ -16,8 +16,8 @@
</valueHelp>
</properties>
<children>
- #include <include/address-ipv4-ipv6.xml.i>
- #include <include/interface-description.xml.i>
+ #include <include/interface/address-ipv4-ipv6.xml.i>
+ #include <include/interface/interface-description.xml.i>
<leafNode name="destination-port">
<properties>
<help>UDP destination port for L2TPv3 tunnel (default: 5000)</help>
@@ -31,7 +31,7 @@
</properties>
<defaultValue>5000</defaultValue>
</leafNode>
- #include <include/interface-disable.xml.i>
+ #include <include/interface/interface-disable.xml.i>
<leafNode name="encapsulation">
<properties>
<help>Encapsulation type (default: UDP)</help>
@@ -53,10 +53,10 @@
</properties>
<defaultValue>udp</defaultValue>
</leafNode>
- #include <include/interface-ipv4-options.xml.i>
- #include <include/interface-ipv6-options.xml.i>
+ #include <include/interface/interface-ipv4-options.xml.i>
+ #include <include/interface/interface-ipv6-options.xml.i>
#include <include/source-address-ipv4-ipv6.xml.i>
- #include <include/interface-mtu-68-16000.xml.i>
+ #include <include/interface/interface-mtu-68-16000.xml.i>
<leafNode name="mtu">
<defaultValue>1488</defaultValue>
</leafNode>
@@ -84,8 +84,8 @@
</constraint>
</properties>
</leafNode>
- #include <include/interface-mtu-68-16000.xml.i>
- #include <include/tunnel-remote.xml.i>
+ #include <include/interface/interface-mtu-68-16000.xml.i>
+ #include <include/interface/tunnel-remote.xml.i>
<leafNode name="session-id">
<properties>
<help>Session identifier</help>
diff --git a/interface-definitions/interfaces-loopback.xml.in b/interface-definitions/interfaces-loopback.xml.in
index 0fd74f302..5d0ca5b0a 100644
--- a/interface-definitions/interfaces-loopback.xml.in
+++ b/interface-definitions/interfaces-loopback.xml.in
@@ -16,14 +16,14 @@
</valueHelp>
</properties>
<children>
- #include <include/address-ipv4-ipv6.xml.i>
- #include <include/interface-description.xml.i>
+ #include <include/interface/address-ipv4-ipv6.xml.i>
+ #include <include/interface/interface-description.xml.i>
<node name="ip">
<properties>
<help>IPv4 routing parameters</help>
</properties>
<children>
- #include <include/interface-source-validation.xml.i>
+ #include <include/interface/interface-source-validation.xml.i>
</children>
</node>
</children>
diff --git a/interface-definitions/interfaces-macsec.xml.in b/interface-definitions/interfaces-macsec.xml.in
index 3f2e5bb69..fce88b21c 100644
--- a/interface-definitions/interfaces-macsec.xml.in
+++ b/interface-definitions/interfaces-macsec.xml.in
@@ -16,9 +16,9 @@
</valueHelp>
</properties>
<children>
- #include <include/address-ipv4-ipv6.xml.i>
- #include <include/interface-ipv4-options.xml.i>
- #include <include/interface-ipv6-options.xml.i>
+ #include <include/interface/address-ipv4-ipv6.xml.i>
+ #include <include/interface/interface-ipv4-options.xml.i>
+ #include <include/interface/interface-ipv6-options.xml.i>
<node name="security">
<properties>
<help>Security/Encryption Settings</help>
@@ -111,14 +111,14 @@
</leafNode>
</children>
</node>
- #include <include/interface-description.xml.i>
- #include <include/interface-disable.xml.i>
- #include <include/interface-mtu-68-16000.xml.i>
+ #include <include/interface/interface-description.xml.i>
+ #include <include/interface/interface-disable.xml.i>
+ #include <include/interface/interface-mtu-68-16000.xml.i>
<leafNode name="mtu">
<defaultValue>1460</defaultValue>
</leafNode>
#include <include/source-interface-ethernet.xml.i>
- #include <include/interface-vrf.xml.i>
+ #include <include/interface/interface-vrf.xml.i>
</children>
</tagNode>
</children>
diff --git a/interface-definitions/interfaces-openvpn.xml.in b/interface-definitions/interfaces-openvpn.xml.in
index 527f7fd54..effbdd674 100644
--- a/interface-definitions/interfaces-openvpn.xml.in
+++ b/interface-definitions/interfaces-openvpn.xml.in
@@ -33,7 +33,7 @@
</leafNode>
</children>
</node>
- #include <include/interface-description.xml.i>
+ #include <include/interface/interface-description.xml.i>
<leafNode name="device-type">
<properties>
<help>OpenVPN interface device-type (default: tun)</help>
@@ -54,7 +54,7 @@
</properties>
<defaultValue>tun</defaultValue>
</leafNode>
- #include <include/interface-disable.xml.i>
+ #include <include/interface/interface-disable.xml.i>
<node name="encryption">
<properties>
<help>Data Encryption settings</help>
@@ -171,7 +171,7 @@
</leafNode>
</children>
</node>
- #include <include/interface-ipv6-options.xml.i>
+ #include <include/interface/interface-ipv6-options.xml.i>
<leafNode name="hash">
<properties>
<help>Hashing Algorithm</help>
@@ -761,7 +761,7 @@
<valueless/>
</properties>
</leafNode>
- #include <include/interface-vrf.xml.i>
+ #include <include/interface/interface-vrf.xml.i>
</children>
</tagNode>
</children>
diff --git a/interface-definitions/interfaces-pppoe.xml.in b/interface-definitions/interfaces-pppoe.xml.in
index 9bbaae9ea..a8e371f85 100644
--- a/interface-definitions/interfaces-pppoe.xml.in
+++ b/interface-definitions/interfaces-pppoe.xml.in
@@ -42,7 +42,7 @@
</leafNode>
</children>
</node>
- #include <include/interface-dial-on-demand.xml.i>
+ #include <include/interface/interface-dial-on-demand.xml.i>
<leafNode name="default-route">
<properties>
<help>Default route insertion behaviour (default: auto)</help>
@@ -68,10 +68,10 @@
</properties>
<defaultValue>auto</defaultValue>
</leafNode>
- #include <include/dhcpv6-options.xml.i>
- #include <include/interface-description.xml.i>
- #include <include/interface-disable.xml.i>
- #include <include/interface-vrf.xml.i>
+ #include <include/interface/dhcpv6-options.xml.i>
+ #include <include/interface/interface-description.xml.i>
+ #include <include/interface/interface-disable.xml.i>
+ #include <include/interface/interface-vrf.xml.i>
<leafNode name="idle-timeout">
<properties>
<help>Delay before disconnecting idle session (in seconds)</help>
@@ -86,7 +86,7 @@
<help>IPv4 routing parameters</help>
</properties>
<children>
- #include <include/interface-source-validation.xml.i>
+ #include <include/interface/interface-source-validation.xml.i>
</children>
</node>
<node name="ipv6">
@@ -99,7 +99,7 @@
<help>IPv6 address configuration modes</help>
</properties>
<children>
- #include <include/ipv6-address-autoconf.xml.i>
+ #include <include/interface/ipv6-address-autoconf.xml.i>
</children>
</node>
</children>
@@ -124,7 +124,7 @@
</constraint>
</properties>
</leafNode>
- #include <include/interface-mtu-68-1500.xml.i>
+ #include <include/interface/interface-mtu-68-1500.xml.i>
<leafNode name="mtu">
<defaultValue>1492</defaultValue>
</leafNode>
diff --git a/interface-definitions/interfaces-pseudo-ethernet.xml.in b/interface-definitions/interfaces-pseudo-ethernet.xml.in
index 32ba5ea01..9e3e0cb26 100644
--- a/interface-definitions/interfaces-pseudo-ethernet.xml.in
+++ b/interface-definitions/interfaces-pseudo-ethernet.xml.in
@@ -16,17 +16,17 @@
</valueHelp>
</properties>
<children>
- #include <include/address-ipv4-ipv6-dhcp.xml.i>
- #include <include/interface-description.xml.i>
- #include <include/dhcp-options.xml.i>
- #include <include/dhcpv6-options.xml.i>
- #include <include/interface-disable-link-detect.xml.i>
- #include <include/interface-disable.xml.i>
- #include <include/interface-vrf.xml.i>
- #include <include/interface-ipv4-options.xml.i>
- #include <include/interface-ipv6-options.xml.i>
+ #include <include/interface/address-ipv4-ipv6-dhcp.xml.i>
+ #include <include/interface/interface-description.xml.i>
+ #include <include/interface/dhcp-options.xml.i>
+ #include <include/interface/dhcpv6-options.xml.i>
+ #include <include/interface/interface-disable-link-detect.xml.i>
+ #include <include/interface/interface-disable.xml.i>
+ #include <include/interface/interface-vrf.xml.i>
+ #include <include/interface/interface-ipv4-options.xml.i>
+ #include <include/interface/interface-ipv6-options.xml.i>
#include <include/source-interface-ethernet.xml.i>
- #include <include/interface-mac.xml.i>
+ #include <include/interface/interface-mac.xml.i>
<leafNode name="mode">
<properties>
<help>Receive mode (default: private)</help>
@@ -56,9 +56,9 @@
</properties>
<defaultValue>private</defaultValue>
</leafNode>
- #include <include/interface-mtu-68-16000.xml.i>
- #include <include/vif-s.xml.i>
- #include <include/vif.xml.i>
+ #include <include/interface/interface-mtu-68-16000.xml.i>
+ #include <include/interface/vif-s.xml.i>
+ #include <include/interface/vif.xml.i>
</children>
</tagNode>
</children>
diff --git a/interface-definitions/interfaces-tunnel.xml.in b/interface-definitions/interfaces-tunnel.xml.in
index 047e06b86..e3aad2719 100644
--- a/interface-definitions/interfaces-tunnel.xml.in
+++ b/interface-definitions/interfaces-tunnel.xml.in
@@ -16,19 +16,19 @@
</valueHelp>
</properties>
<children>
- #include <include/interface-description.xml.i>
- #include <include/address-ipv4-ipv6.xml.i>
- #include <include/interface-disable.xml.i>
- #include <include/interface-disable-link-detect.xml.i>
- #include <include/interface-vrf.xml.i>
- #include <include/interface-mtu-64-8024.xml.i>
+ #include <include/interface/interface-description.xml.i>
+ #include <include/interface/address-ipv4-ipv6.xml.i>
+ #include <include/interface/interface-disable.xml.i>
+ #include <include/interface/interface-disable-link-detect.xml.i>
+ #include <include/interface/interface-vrf.xml.i>
+ #include <include/interface/interface-mtu-64-8024.xml.i>
<leafNode name="mtu">
<defaultValue>1476</defaultValue>
</leafNode>
- #include <include/interface-ipv4-options.xml.i>
- #include <include/interface-ipv6-options.xml.i>
+ #include <include/interface/interface-ipv4-options.xml.i>
+ #include <include/interface/interface-ipv6-options.xml.i>
#include <include/source-address-ipv4-ipv6.xml.i>
- #include <include/tunnel-remote.xml.i>
+ #include <include/interface/tunnel-remote.xml.i>
<leafNode name="source-interface">
<properties>
<help>Physical Interface used for underlaying traffic</help>
@@ -156,9 +156,9 @@
<valueless/>
</properties>
</leafNode>
- #include <include/interface-parameters-key.xml.i>
- #include <include/interface-parameters-tos.xml.i>
- #include <include/interface-parameters-ttl.xml.i>
+ #include <include/interface/interface-parameters-key.xml.i>
+ #include <include/interface/interface-parameters-tos.xml.i>
+ #include <include/interface/interface-parameters-ttl.xml.i>
</children>
</node>
<node name="ipv6">
@@ -168,19 +168,27 @@
<children>
<leafNode name="encaplimit">
<properties>
- <help>Encaplimit field</help>
+ <help>Set fixed encapsulation limit</help>
+ <completionHelp>
+ <list>none</list>
+ </completionHelp>
<valueHelp>
<format>0-255</format>
<description>Encaplimit (default: 4)</description>
</valueHelp>
+ <valueHelp>
+ <format>none</format>
+ <description>Encaplimit disabled</description>
+ </valueHelp>
<constraint>
+ <regex>^(none)$</regex>
<validator name="numeric" argument="--range 0-255"/>
</constraint>
- <constraintErrorMessage>key must be between 0-255</constraintErrorMessage>
+ <constraintErrorMessage>Tunnel encaplimit must be 0-255 or none</constraintErrorMessage>
</properties>
<defaultValue>4</defaultValue>
</leafNode>
- #include <include/interface-parameters-flowlabel.xml.i>
+ #include <include/interface/interface-parameters-flowlabel.xml.i>
<leafNode name="hoplimit">
<properties>
<help>Hoplimit</help>
diff --git a/interface-definitions/interfaces-vxlan.xml.in b/interface-definitions/interfaces-vxlan.xml.in
index 97a40a9dc..7a286eaf2 100644
--- a/interface-definitions/interfaces-vxlan.xml.in
+++ b/interface-definitions/interfaces-vxlan.xml.in
@@ -16,9 +16,9 @@
</valueHelp>
</properties>
<children>
- #include <include/address-ipv4-ipv6.xml.i>
- #include <include/interface-description.xml.i>
- #include <include/interface-disable.xml.i>
+ #include <include/interface/address-ipv4-ipv6.xml.i>
+ #include <include/interface/interface-description.xml.i>
+ #include <include/interface/interface-disable.xml.i>
<leafNode name="group">
<properties>
<help>Multicast group address for VXLAN interface</help>
@@ -35,10 +35,10 @@
</constraint>
</properties>
</leafNode>
- #include <include/interface-ipv4-options.xml.i>
- #include <include/interface-ipv6-options.xml.i>
- #include <include/interface-mac.xml.i>
- #include <include/interface-mtu-1200-16000.xml.i>
+ #include <include/interface/interface-ipv4-options.xml.i>
+ #include <include/interface/interface-ipv6-options.xml.i>
+ #include <include/interface/interface-mac.xml.i>
+ #include <include/interface/interface-mtu-1200-16000.xml.i>
<leafNode name="mtu">
<defaultValue>1450</defaultValue>
</leafNode>
@@ -52,9 +52,9 @@
<help>IPv4 specific tunnel parameters</help>
</properties>
<children>
- #include <include/interface-parameters-dont-fragment.xml.i>
- #include <include/interface-parameters-tos.xml.i>
- #include <include/interface-parameters-ttl.xml.i>
+ #include <include/interface/interface-parameters-dont-fragment.xml.i>
+ #include <include/interface/interface-parameters-tos.xml.i>
+ #include <include/interface/interface-parameters-ttl.xml.i>
<leafNode name="ttl">
<defaultValue>16</defaultValue>
</leafNode>
@@ -65,7 +65,7 @@
<help>IPv6 specific tunnel parameters</help>
</properties>
<children>
- #include <include/interface-parameters-flowlabel.xml.i>
+ #include <include/interface/interface-parameters-flowlabel.xml.i>
</children>
</node>
<leafNode name="nolearning">
@@ -91,7 +91,7 @@
</leafNode>
#include <include/source-address-ipv4-ipv6.xml.i>
#include <include/source-interface.xml.i>
- #include <include/tunnel-remote.xml.i>
+ #include <include/interface/tunnel-remote.xml.i>
#include <include/vni.xml.i>
</children>
</tagNode>
diff --git a/interface-definitions/interfaces-wireguard.xml.in b/interface-definitions/interfaces-wireguard.xml.in
index 3f56046c4..378251fed 100644
--- a/interface-definitions/interfaces-wireguard.xml.in
+++ b/interface-definitions/interfaces-wireguard.xml.in
@@ -16,17 +16,17 @@
</valueHelp>
</properties>
<children>
- #include <include/address-ipv4-ipv6.xml.i>
- #include <include/interface-description.xml.i>
- #include <include/interface-disable.xml.i>
- #include <include/interface-vrf.xml.i>
+ #include <include/interface/address-ipv4-ipv6.xml.i>
+ #include <include/interface/interface-description.xml.i>
+ #include <include/interface/interface-disable.xml.i>
+ #include <include/interface/interface-vrf.xml.i>
#include <include/port-number.xml.i>
- #include <include/interface-mtu-68-16000.xml.i>
+ #include <include/interface/interface-mtu-68-16000.xml.i>
<leafNode name="mtu">
<defaultValue>1420</defaultValue>
</leafNode>
- #include <include/interface-ipv4-options.xml.i>
- #include <include/interface-ipv6-options.xml.i>
+ #include <include/interface/interface-ipv4-options.xml.i>
+ #include <include/interface/interface-ipv6-options.xml.i>
<leafNode name="fwmark">
<properties>
<help>A 32-bit fwmark value set on all outgoing packets</help>
diff --git a/interface-definitions/interfaces-wireless.xml.in b/interface-definitions/interfaces-wireless.xml.in
index f39e5618f..aaeb285f1 100644
--- a/interface-definitions/interfaces-wireless.xml.in
+++ b/interface-definitions/interfaces-wireless.xml.in
@@ -16,7 +16,7 @@
</valueHelp>
</properties>
<children>
- #include <include/address-ipv4-ipv6-dhcp.xml.i>
+ #include <include/interface/address-ipv4-ipv6-dhcp.xml.i>
<node name="capabilities">
<properties>
<help>HT and VHT capabilities for your card</help>
@@ -464,34 +464,34 @@
<constraintErrorMessage>Invalid ISO/IEC 3166-1 Country Code</constraintErrorMessage>
</properties>
</leafNode>
- #include <include/interface-description.xml.i>
- #include <include/dhcp-options.xml.i>
- #include <include/dhcpv6-options.xml.i>
+ #include <include/interface/interface-description.xml.i>
+ #include <include/interface/dhcp-options.xml.i>
+ #include <include/interface/dhcpv6-options.xml.i>
<leafNode name="disable-broadcast-ssid">
<properties>
<help>Disable broadcast of SSID from access-point</help>
<valueless/>
</properties>
</leafNode>
- #include <include/interface-disable-link-detect.xml.i>
- #include <include/interface-disable.xml.i>
- #include <include/interface-vrf.xml.i>
+ #include <include/interface/interface-disable-link-detect.xml.i>
+ #include <include/interface/interface-disable.xml.i>
+ #include <include/interface/interface-vrf.xml.i>
<leafNode name="expunge-failing-stations">
<properties>
<help>Disassociate stations based on excessive transmission failures</help>
<valueless/>
</properties>
</leafNode>
- #include <include/interface-ipv4-options.xml.i>
- #include <include/interface-ipv6-options.xml.i>
- #include <include/interface-hw-id.xml.i>
+ #include <include/interface/interface-ipv4-options.xml.i>
+ #include <include/interface/interface-ipv6-options.xml.i>
+ #include <include/interface/interface-hw-id.xml.i>
<leafNode name="isolate-stations">
<properties>
<help>Isolate stations on the AP so they cannot see each other</help>
<valueless/>
</properties>
</leafNode>
- #include <include/interface-mac.xml.i>
+ #include <include/interface/interface-mac.xml.i>
<leafNode name="max-stations">
<properties>
<help>Maximum number of wireless radio stations. Excess stations will be rejected upon authentication request.</help>
@@ -775,8 +775,8 @@
</properties>
<defaultValue>monitor</defaultValue>
</leafNode>
- #include <include/vif.xml.i>
- #include <include/vif-s.xml.i>
+ #include <include/interface/vif.xml.i>
+ #include <include/interface/vif-s.xml.i>
</children>
</tagNode>
</children>
diff --git a/interface-definitions/interfaces-wirelessmodem.xml.in b/interface-definitions/interfaces-wirelessmodem.xml.in
index 969ff0014..25ac2d6e0 100644
--- a/interface-definitions/interfaces-wirelessmodem.xml.in
+++ b/interface-definitions/interfaces-wirelessmodem.xml.in
@@ -42,9 +42,9 @@
</leafNode>
</children>
</node>
- #include <include/interface-description.xml.i>
- #include <include/interface-disable.xml.i>
- #include <include/interface-vrf.xml.i>
+ #include <include/interface/interface-description.xml.i>
+ #include <include/interface/interface-disable.xml.i>
+ #include <include/interface/interface-vrf.xml.i>
<leafNode name="device">
<properties>
<help>Serial device </help>
@@ -65,17 +65,17 @@
</constraint>
</properties>
</leafNode>
- #include <include/interface-disable-link-detect.xml.i>
- #include <include/interface-mtu-68-16000.xml.i>
- #include <include/interface-ipv4-options.xml.i>
- #include <include/interface-ipv6-options.xml.i>
+ #include <include/interface/interface-disable-link-detect.xml.i>
+ #include <include/interface/interface-mtu-68-16000.xml.i>
+ #include <include/interface/interface-ipv4-options.xml.i>
+ #include <include/interface/interface-ipv6-options.xml.i>
<leafNode name="no-peer-dns">
<properties>
<help>Do not use peer supplied DNS server information</help>
<valueless/>
</properties>
</leafNode>
- #include <include/interface-dial-on-demand.xml.i>
+ #include <include/interface/interface-dial-on-demand.xml.i>
</children>
</tagNode>
</children>
diff --git a/interface-definitions/ntp.xml.in b/interface-definitions/ntp.xml.in
index d244b56bb..2bfac900b 100644
--- a/interface-definitions/ntp.xml.in
+++ b/interface-definitions/ntp.xml.in
@@ -82,7 +82,7 @@
</children>
</node>
#include <include/listen-address.xml.i>
- #include <include/interface-vrf.xml.i>
+ #include <include/interface/interface-vrf.xml.i>
</children>
</node>
</children>
diff --git a/interface-definitions/policy-lists.xml.in b/interface-definitions/policy-lists.xml.in
new file mode 100644
index 000000000..a0bea2ce2
--- /dev/null
+++ b/interface-definitions/policy-lists.xml.in
@@ -0,0 +1,1266 @@
+<?xml version="1.0"?>
+<!-- Policy access|prefix|route-map lists -->
+<interfaceDefinition>
+ <node name="npolicy" owner="${vyos_conf_scripts_dir}/policy-lists.py">
+ <properties>
+ <help>Routing policy</help>
+ </properties>
+ <children>
+ <tagNode name="access-list">
+ <properties>
+ <help>IP access-list filter</help>
+ <priority>470</priority>
+ <valueHelp>
+ <format>u32:1-99</format>
+ <description>IP standard access list</description>
+ </valueHelp>
+ <valueHelp>
+ <format>u32:100-199</format>
+ <description>IP extended access list</description>
+ </valueHelp>
+ <valueHelp>
+ <format>u32:1300-1999</format>
+ <description>IP standard access list (expanded range)</description>
+ </valueHelp>
+ <valueHelp>
+ <format>u32:2000-2699</format>
+ <description>IP extended access list (expanded range)</description>
+ </valueHelp>
+ </properties>
+ <children>
+ #include <include/policy-list-description.xml.i>
+ <tagNode name="rule">
+ <properties>
+ <help>Rule for this access-list</help>
+ <valueHelp>
+ <format>u32:1-65535</format>
+ <description>Access-list rule number</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-65535"/>
+ </constraint>
+ </properties>
+ <children>
+ #include <include/policy-list-action.xml.i>
+ #include <include/policy-list-rule-description.xml.i>
+ <node name="destination">
+ <properties>
+ <help>Destination network or address</help>
+ </properties>
+ <children>
+ <leafNode name="any">
+ <properties>
+ <help>Any IP address to match</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="host">
+ <properties>
+ <help>Single host IP address to match</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>Host address to match</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-host"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="inverse-mask">
+ <properties>
+ <help>Network/netmask to match (requires network be defined)</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>Inverse-mask to match</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-address"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="network">
+ <properties>
+ <help>Network/netmask to match (requires inverse-mask be defined)</help>
+ <valueHelp>
+ <format>ipv4net</format>
+ <description>Inverse-mask to match</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ip-prefix"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <node name="source">
+ <properties>
+ <help>Source network or address to match</help>
+ </properties>
+ <children>
+ <leafNode name="any">
+ <properties>
+ <help>Any IP address to match</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="host">
+ <properties>
+ <help>Single host IP address to match</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>Host address to match</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-host"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="inverse-mask">
+ <properties>
+ <help>Network/netmask to match (requires network be defined)</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>Inverse-mask to match</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-address"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="network">
+ <properties>
+ <help>Network/netmask to match (requires inverse-mask be defined)</help>
+ <valueHelp>
+ <format>ipv4net</format>
+ <description>Inverse-mask to match</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ip-prefix"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ </children>
+ </tagNode>
+ </children>
+ </tagNode>
+ <tagNode name="access-list6">
+ <properties>
+ <help>IPv6 access-list filter</help>
+ <priority>470</priority>
+ <valueHelp>
+ <format>txt</format>
+ <description>Name of IPv6 access-list</description>
+ </valueHelp>
+ </properties>
+ <children>
+ #include <include/policy-list-description.xml.i>
+ <tagNode name="rule">
+ <properties>
+ <help>Rule for this access-list6</help>
+ <valueHelp>
+ <format>u32:1-65535</format>
+ <description>Access-list6 rule number</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-65535"/>
+ </constraint>
+ </properties>
+ <children>
+ #include <include/policy-list-action.xml.i>
+ #include <include/policy-list-rule-description.xml.i>
+ <node name="source">
+ <properties>
+ <help>Source IPv6 network to match</help>
+ </properties>
+ <children>
+ <leafNode name="any">
+ <properties>
+ <help>Any IP address to match</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="exact-match">
+ <properties>
+ <help>Exact match of the network prefixes</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ <leafNode name="network">
+ <properties>
+ <help>Network/netmask to match</help>
+ <valueHelp>
+ <format>ipv6net</format>
+ <description>IPv6 address and prefix length</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv6-prefix"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ </children>
+ </tagNode>
+ </children>
+ </tagNode>
+ <tagNode name="as-path-list">
+ <properties>
+ <help>Border Gateway Protocol (BGP) autonomous system path filter</help>
+ <priority>470</priority>
+ <valueHelp>
+ <format>txt</format>
+ <description>AS path list name</description>
+ </valueHelp>
+ </properties>
+ <children>
+ #include <include/policy-list-description.xml.i>
+ <tagNode name="rule">
+ <properties>
+ <help>Rule for this as-path-list</help>
+ <valueHelp>
+ <format>u32:1-65535</format>
+ <description>AS path list rule number</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-65535"/>
+ </constraint>
+ </properties>
+ <children>
+ #include <include/policy-list-action.xml.i>
+ #include <include/policy-list-rule-description.xml.i>
+ <leafNode name="regex">
+ <properties>
+ <help>Regular expression to match against an AS path</help>
+ <valueHelp>
+ <format>&lt;asn&gt;</format>
+ <description>AS path regular expression (ex: "64501 64502")</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ </children>
+ </tagNode>
+ </children>
+ </tagNode>
+ <tagNode name="community-list">
+ <properties>
+ <help>Border Gateway Protocol (BGP) autonomous system path filter</help>
+ <priority>470</priority>
+ <valueHelp>
+ <format>txt</format>
+ <description>Border Gateway Protocol (BGP) community-list filter</description>
+ </valueHelp>
+ </properties>
+ <children>
+ #include <include/policy-list-description.xml.i>
+ <tagNode name="rule">
+ <properties>
+ <help>Rule for this BGP community list</help>
+ <valueHelp>
+ <format>u32:1-65535</format>
+ <description>Community-list rule number</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-65535"/>
+ </constraint>
+ </properties>
+ <children>
+ #include <include/policy-list-action.xml.i>
+ #include <include/policy-list-rule-description.xml.i>
+ <leafNode name="regex">
+ <properties>
+ <help>Regular expression to match against a community list</help>
+ <valueHelp>
+ <format>&lt;aa:nn&gt;</format>
+ <description>Community list regular expression or one of: internet, local-AS, no-advertise, no-export</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ </children>
+ </tagNode>
+ </children>
+ </tagNode>
+ <tagNode name="extcommunity-list">
+ <properties>
+ <help>Border Gateway Protocol (BGP) extended community-list filter</help>
+ <priority>490</priority>
+ <valueHelp>
+ <format>txt</format>
+ <description>Border Gateway Protocol (BGP) extended community-list filter</description>
+ </valueHelp>
+ </properties>
+ <children>
+ #include <include/policy-list-description.xml.i>
+ <tagNode name="rule">
+ <properties>
+ <help>Rule for this BGP extended community list</help>
+ <valueHelp>
+ <format>u32:1-65535</format>
+ <description>Extended community-list rule number</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-65535"/>
+ </constraint>
+ </properties>
+ <children>
+ #include <include/policy-list-action.xml.i>
+ #include <include/policy-list-rule-description.xml.i>
+ <leafNode name="regex">
+ <properties>
+ <help>Regular expression to match against an extended community list</help>
+ <valueHelp>
+ <format>&lt;aa:nn:nn&gt;</format>
+ <description>Extended community list regular expression</description>
+ </valueHelp>
+ <valueHelp>
+ <format>&lt;rt aa:nn:nn&gt;</format>
+ <description>Extended community list regular expression</description>
+ </valueHelp>
+ <valueHelp>
+ <format>&lt;soo aa:nn&gt;</format>
+ <description>Extended community list regular expression</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ </children>
+ </tagNode>
+ </children>
+ </tagNode>
+ <tagNode name="large-community-list">
+ <properties>
+ <help>Border Gateway Protocol (BGP) large-community-list filter</help>
+ <priority>470</priority>
+ <valueHelp>
+ <format>txt</format>
+ <description>Border Gateway Protocol (BGP) large-community-list filter</description>
+ </valueHelp>
+ </properties>
+ <children>
+ #include <include/policy-list-description.xml.i>
+ <tagNode name="rule">
+ <properties>
+ <help>Rule for this BGP extended community list</help>
+ <valueHelp>
+ <format>u32:1-65535</format>
+ <description>Large community-list rule number</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-65535"/>
+ </constraint>
+ </properties>
+ <children>
+ #include <include/policy-list-action.xml.i>
+ #include <include/policy-list-rule-description.xml.i>
+ <leafNode name="regex">
+ <properties>
+ <help>Regular expression to match against a large community list</help>
+ <valueHelp>
+ <format>&lt;aa:nn:nn&gt;</format>
+ <description>Large community list regular expression</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ </children>
+ </tagNode>
+ </children>
+ </tagNode>
+ <tagNode name="prefix-list">
+ <properties>
+ <help>IP prefix-list filter</help>
+ <priority>470</priority>
+ <valueHelp>
+ <format>txt</format>
+ <description>Prefix list name</description>
+ </valueHelp>
+ </properties>
+ <children>
+ #include <include/policy-list-description.xml.i>
+ <tagNode name="rule">
+ <properties>
+ <help>Rule for this prefix-list</help>
+ <valueHelp>
+ <format>u32:1-65535</format>
+ <description>Prefix-list rule number</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-65535"/>
+ </constraint>
+ </properties>
+ <children>
+ #include <include/policy-list-action.xml.i>
+ #include <include/policy-list-rule-description.xml.i>
+ <leafNode name="ge">
+ <properties>
+ <help>Prefix length to match a netmask greater than or equal to it</help>
+ <valueHelp>
+ <format>u32:0-32</format>
+ <description>Netmask greater than length</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-32"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="le">
+ <properties>
+ <help>Prefix length to match a netmask less than or equal to it</help>
+ <valueHelp>
+ <format>u32:0-32</format>
+ <description>Netmask less than length</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-32"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="prefix">
+ <properties>
+ <help>Prefix to match</help>
+ <valueHelp>
+ <format>ipv4net</format>
+ <description>Prefix to match against</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ip-prefix"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </tagNode>
+ </children>
+ </tagNode>
+ <tagNode name="prefix-list6">
+ <properties>
+ <help>IPv6 prefix-list filter</help>
+ <priority>470</priority>
+ <valueHelp>
+ <format>txt</format>
+ <description>Prefix list name</description>
+ </valueHelp>
+ </properties>
+ <children>
+ #include <include/policy-list-description.xml.i>
+ <tagNode name="rule">
+ <properties>
+ <help>Rule for this prefix-list6</help>
+ <valueHelp>
+ <format>u32:1-65535</format>
+ <description>Prefix-list rule number</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-65535"/>
+ </constraint>
+ </properties>
+ <children>
+ #include <include/policy-list-action.xml.i>
+ #include <include/policy-list-rule-description.xml.i>
+ <leafNode name="ge">
+ <properties>
+ <help>Prefix length to match a netmask greater than or equal to it</help>
+ <valueHelp>
+ <format>u32:0-128</format>
+ <description>Netmask greater than length</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-128"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="le">
+ <properties>
+ <help>Prefix length to match a netmask less than or equal to it</help>
+ <valueHelp>
+ <format>u32:0-128</format>
+ <description>Netmask less than length</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-128"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="prefix">
+ <properties>
+ <help>Prefix to match</help>
+ <valueHelp>
+ <format>ipv6net</format>
+ <description>IPv6 prefix</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv6-prefix"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </tagNode>
+ </children>
+ </tagNode>
+ <tagNode name="route-map">
+ <properties>
+ <help>IP route-map</help>
+ <priority>470</priority>
+ <valueHelp>
+ <format>txt</format>
+ <description>Route map name</description>
+ </valueHelp>
+ </properties>
+ <children>
+ #include <include/policy-list-description.xml.i>
+ <tagNode name="rule">
+ <properties>
+ <help>Rule for this route-map</help>
+ <valueHelp>
+ <format>u32:1-65535</format>
+ <description>Route-map rule number</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-65535"/>
+ </constraint>
+ </properties>
+ <children>
+ #include <include/policy-list-action.xml.i>
+ <leafNode name="call">
+ <properties>
+ <help>Call another route-map on match</help>
+ <valueHelp>
+ <format>txt</format>
+ <description>Route map name</description>
+ </valueHelp>
+ <completionHelp>
+ <path>policy route-map</path>
+ </completionHelp>
+ </properties>
+ </leafNode>
+ <leafNode name="continue">
+ <properties>
+ <help>Jump to a different rule in this route-map on a match</help>
+ <valueHelp>
+ <format>u32:1-65535</format>
+ <description>Rule number</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ #include <include/policy-list-rule-description.xml.i>
+ <node name="match">
+ <properties>
+ <help>Route parameters to match</help>
+ </properties>
+ <children>
+ <leafNode name="as-path">
+ <properties>
+ <help>BGP as-path-list to match</help>
+ <completionHelp>
+ <path>policy as-path-list</path>
+ </completionHelp>
+ </properties>
+ </leafNode>
+ <node name="community">
+ <properties>
+ <help>BGP community-list to match</help>
+ </properties>
+ <children>
+ <leafNode name="community-list">
+ <properties>
+ <help>BGP community-list to match</help>
+ <completionHelp>
+ <path>policy community-list</path>
+ </completionHelp>
+ </properties>
+ </leafNode>
+ <leafNode name="exact-match">
+ <properties>
+ <help>Community-list to exactly match</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <leafNode name="extcommunity">
+ <properties>
+ <help>BGP extended community to match</help>
+ <completionHelp>
+ <path>policy extcommunity-list</path>
+ </completionHelp>
+ </properties>
+ </leafNode>
+ <leafNode name="interface">
+ <properties>
+ <help>First hop interface of a route to match</help>
+ <completionHelp>
+ <script>${vyos_completion_dir}/list_interfaces.py</script>
+ </completionHelp>
+ </properties>
+ </leafNode>
+ <node name="ip">
+ <properties>
+ <help>IP prefix parameters to match</help>
+ </properties>
+ <children>
+ <node name="address">
+ <properties>
+ <help>IP address of route to match</help>
+ </properties>
+ <children>
+ <leafNode name="access-list">
+ <properties>
+ <help>IP access-list to match</help>
+ <valueHelp>
+ <format>u32:1-99</format>
+ <description>IP standard access list</description>
+ </valueHelp>
+ <valueHelp>
+ <format>u32:100-199</format>
+ <description>IP extended access list</description>
+ </valueHelp>
+ <valueHelp>
+ <format>u32:1300-1999</format>
+ <description>IP standard access list (expanded range)</description>
+ </valueHelp>
+ <valueHelp>
+ <format>u32:2000-2699</format>
+ <description>IP extended access list (expanded range)</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ <leafNode name="prefix-list">
+ <properties>
+ <help>IP prefix-list to match</help>
+ <completionHelp>
+ <path>policy prefix-list</path>
+ </completionHelp>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <!-- T3304 but it overwrite node nexthop
+ <leafNode name="nexthop">
+ <properties>
+ <help>IP next-hop of route to match</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>Next-hop IPv4 router address</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-address"/>
+ </constraint>
+ </properties>
+ </leafNode> -->
+ <node name="nexthop">
+ <properties>
+ <help>IP next-hop of route to match</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>Next-hop IPv4 router address</description>
+ </valueHelp>
+ </properties>
+ <children>
+ <leafNode name="access-list">
+ <properties>
+ <help>IP access-list to match</help>
+ <valueHelp>
+ <format>u32:1-99</format>
+ <description>IP standard access list</description>
+ </valueHelp>
+ <valueHelp>
+ <format>u32:100-199</format>
+ <description>IP extended access list</description>
+ </valueHelp>
+ <valueHelp>
+ <format>u32:1300-1999</format>
+ <description>IP standard access list (expanded range)</description>
+ </valueHelp>
+ <valueHelp>
+ <format>u32:2000-2699</format>
+ <description>IP extended access list (expanded range)</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ <leafNode name="prefix-list">
+ <properties>
+ <help>IP prefix-list to match</help>
+ <completionHelp>
+ <path>policy prefix-list</path>
+ </completionHelp>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <node name="route-source">
+ <properties>
+ <help>test</help>
+ </properties>
+ <children>
+ <leafNode name="access-list">
+ <properties>
+ <help>IP access-list to match</help>
+ <valueHelp>
+ <format>u32:1-99</format>
+ <description>IP standard access list</description>
+ </valueHelp>
+ <valueHelp>
+ <format>u32:100-199</format>
+ <description>IP extended access list</description>
+ </valueHelp>
+ <valueHelp>
+ <format>u32:1300-1999</format>
+ <description>IP standard access list (expanded range)</description>
+ </valueHelp>
+ <valueHelp>
+ <format>u32:2000-2699</format>
+ <description>IP extended access list (expanded range)</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ <leafNode name="prefix-list">
+ <properties>
+ <help>IP prefix-list to match</help>
+ <completionHelp>
+ <path>policy prefix-list</path>
+ </completionHelp>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ </children>
+ </node>
+ <node name="ipv6">
+ <properties>
+ <help>IPv6 prefix parameters to match</help>
+ </properties>
+ <children>
+ <node name="address">
+ <properties>
+ <help>IPv6 address of route to match</help>
+ </properties>
+ <children>
+ <leafNode name="access-list">
+ <properties>
+ <help>IPv6 access-list to match</help>
+ <valueHelp>
+ <format>txt</format>
+ <description>IPV6 access list name</description>
+ </valueHelp>
+ <completionHelp>
+ <path>policy access-list6</path>
+ </completionHelp>
+ </properties>
+ </leafNode>
+ <leafNode name="prefix-list">
+ <properties>
+ <help>IPv6 prefix-list to match</help>
+ <completionHelp>
+ <path>policy prefix-list6</path>
+ </completionHelp>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <leafNode name="nexthop">
+ <properties>
+ <help>IPv6 next-hop of route to match</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>Peer IP address</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-address"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <node name="large-community">
+ <properties>
+ <help>Match BGP large communities</help>
+ </properties>
+ <children>
+ <leafNode name="large-community-list">
+ <properties>
+ <help>BGP large-community-list to match</help>
+ <completionHelp>
+ <path>policy large-community-list</path>
+ </completionHelp>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <leafNode name="local-preference">
+ <properties>
+ <help>local-preference_help</help>
+ <valueHelp>
+ <format>u32:0-4294967295</format>
+ <description>Local Preference</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-4294967295"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="metric">
+ <properties>
+ <help>Metric of route to match</help>
+ <valueHelp>
+ <format>u32:1-65535</format>
+ <description>Route metric</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-65535"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="origin">
+ <properties>
+ <help>Border Gateway Protocol (BGP) origin code to match</help>
+ <completionHelp>
+ <list>egp igp incomplete</list>
+ </completionHelp>
+ <valueHelp>
+ <format>egp</format>
+ <description>Exterior gateway protocol origin</description>
+ </valueHelp>
+ <valueHelp>
+ <format>igp</format>
+ <description>Interior gateway protocol origin</description>
+ </valueHelp>
+ <valueHelp>
+ <format>incomplete</format>
+ <description>Incomplete origin</description>
+ </valueHelp>
+ <constraint>
+ <regex>^(egp|igp|incomplete)$</regex>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="peer">
+ <properties>
+ <help>Peer address to match</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>Peer IP address</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-address"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="rpki">
+ <properties>
+ <help>Match RPKI validation result</help>
+ <completionHelp>
+ <list>invalid notfound valid</list>
+ </completionHelp>
+ <valueHelp>
+ <format>invalid</format>
+ <description>Match invalid entries</description>
+ </valueHelp>
+ <valueHelp>
+ <format>notfound</format>
+ <description>Match notfound entries</description>
+ </valueHelp>
+ <valueHelp>
+ <format>valid</format>
+ <description>Match valid entries</description>
+ </valueHelp>
+ <constraint>
+ <regex>^(invalid|notfound|valid)$</regex>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="tag">
+ <properties>
+ <help>Route tag to match</help>
+ <valueHelp>
+ <format>u32:1-65535</format>
+ <description>Route tag</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-65535"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <node name="on-match">
+ <properties>
+ <help>Exit policy on matches</help>
+ </properties>
+ <children>
+ <leafNode name="goto">
+ <properties>
+ <help>Rule number to goto on match</help>
+ <valueHelp>
+ <format>u32:1-65535</format>
+ <description>Rule number</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-65535"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="next">
+ <properties>
+ <help>Next sequence number to goto on match</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <node name="set">
+ <properties>
+ <help>Route parameters</help>
+ </properties>
+ <children>
+ <node name="aggregator">
+ <properties>
+ <help>Border Gateway Protocol (BGP) aggregator attribute</help>
+ </properties>
+ <children>
+ <leafNode name="as">
+ <properties>
+ <help>AS number of an aggregation</help>
+ <valueHelp>
+ <format>u32:1-4294967295</format>
+ <description>Rule number</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-4294967295"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="ip">
+ <properties>
+ <help>IP address of an aggregation</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>IP address</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-address"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <leafNode name="as-path-exclude">
+ <properties>
+ <help>Remove ASN(s) from a Border Gateway Protocol (BGP) AS-path attribute</help>
+ <valueHelp>
+ <format>txt</format>
+ <description>BGP AS path exclude string (ex: "456 64500 45001")</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ <leafNode name="as-path-prepend">
+ <properties>
+ <help>as-path-prepend_help</help>
+ <valueHelp>
+ <format>txt</format>
+ <description>BGP AS path prepend string (ex: "64501 64501")</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ <leafNode name="atomic-aggregate">
+ <properties>
+ <help>Border Gateway Protocol (BGP) atomic aggregate attribute</help>
+ </properties>
+ </leafNode>
+ <leafNode name="bgp-extcommunity-rt">
+ <properties>
+ <help>Set route target value</help>
+ <valueHelp>
+ <format>&lt;aa:nn&gt;</format>
+ <description>ExtCommunity in format: asn:value</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ <node name="comm-list">
+ <properties>
+ <help>Border Gateway Protocol (BGP) communities matching a community-list</help>
+ </properties>
+ <children>
+ <leafNode name="comm-list">
+ <properties>
+ <help>BGP communities with a community-list</help>
+ <valueHelp>
+ <format>txt</format>
+ <description>BGP communities with a community-list</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ <leafNode name="delete">
+ <properties>
+ <help>Delete BGP communities matching the community-list</help>
+ <valueless/>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <leafNode name="community">
+ <properties>
+ <help>community_help</help>
+ <completionHelp>
+ <list>local-AS no-advertise no-export internet additive none</list>
+ </completionHelp>
+ <valueHelp>
+ <format>&lt;aa:nn&gt;</format>
+ <description>Community in 4 octet AS:value format</description>
+ </valueHelp>
+ <valueHelp>
+ <format>local-AS</format>
+ <description>local-AS</description>
+ </valueHelp>
+ <valueHelp>
+ <format>no-advertise</format>
+ <description>no-advertise</description>
+ </valueHelp>
+ <valueHelp>
+ <format>no-export</format>
+ <description>no-export</description>
+ </valueHelp>
+ <valueHelp>
+ <format>internet</format>
+ <description>internet</description>
+ </valueHelp>
+ <valueHelp>
+ <format>additive</format>
+ <description>additive</description>
+ </valueHelp>
+ <valueHelp>
+ <format>none</format>
+ <description>none</description>
+ </valueHelp>
+ <!-- Need to add properly validator
+ <constraint>
+ <regex>^(local-AS|no-advertise|no-export|internet|additive|none)$</regex>
+ </constraint> -->
+ </properties>
+ </leafNode>
+ <leafNode name="distance">
+ <properties>
+ <help>Locally significant administrative distance</help>
+ <valueHelp>
+ <format>u32:0-255</format>
+ <description>Distance value</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-255"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="extcommunity-rt">
+ <properties>
+ <help>Set route target value</help>
+ <valueHelp>
+ <format>txt</format>
+ <description>ASN:nn_or_IP_address:nn VPN extended community</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ <leafNode name="extcommunity-soo">
+ <properties>
+ <help>Set Site of Origin value</help>
+ <valueHelp>
+ <format>txt</format>
+ <description>ASN:nn_or_IP_address:nn VPN extended community</description>
+ </valueHelp>
+ </properties>
+ </leafNode>
+ <leafNode name="ip-next-hop">
+ <properties>
+ <help>Nexthop IP address</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>IP address</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-address"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <node name="ipv6-next-hop">
+ <properties>
+ <help>Nexthop IPv6 address</help>
+ </properties>
+ <children>
+ <leafNode name="global">
+ <properties>
+ <help>Nexthop IPv6 global address</help>
+ <valueHelp>
+ <format>ipv6</format>
+ <description>IPv6 address and prefix length</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv6-address"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="local">
+ <properties>
+ <help>Nexthop IPv6 local address</help>
+ <valueHelp>
+ <format>ipv6</format>
+ <description>IPv6 address and prefix length</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv6-address"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ <leafNode name="large-community">
+ <properties>
+ <help>Set BGP large community value</help>
+ <valueHelp>
+ <format>txt</format>
+ <description>ASN:nn:mm BGP large community</description>
+ </valueHelp>
+ <completionHelp>
+ <path>policy large-community-list</path>
+ </completionHelp>
+ </properties>
+ </leafNode>
+ <leafNode name="local-preference">
+ <properties>
+ <help>Border Gateway Protocol (BGP) local preference attribute</help>
+ <valueHelp>
+ <format>u32:0-4294967295</format>
+ <description>Local preference value</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-4294967295"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="metric">
+ <properties>
+ <help>Destination routing protocol metric</help>
+ <valueHelp>
+ <format>&lt;+/-metric&gt;</format>
+ <description>Add or subtract metric</description>
+ </valueHelp>
+ <valueHelp>
+ <format>u32:0-4294967295</format>
+ <description>Metric value</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-4294967295"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="metric-type">
+ <properties>
+ <help>Open Shortest Path First (OSPF) external metric-type</help>
+ <completionHelp>
+ <list>type-1 type-2</list>
+ </completionHelp>
+ <valueHelp>
+ <format>type-1</format>
+ <description>OSPF external type 1 metric</description>
+ </valueHelp>
+ <valueHelp>
+ <format>type-2</format>
+ <description>OSPF external type 2 metric</description>
+ </valueHelp>
+ <constraint>
+ <regex>^(type-1|type-2)$</regex>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="origin">
+ <properties>
+ <help>origin_help</help>
+ <completionHelp>
+ <list>igp egp incomplete</list>
+ </completionHelp>
+ <valueHelp>
+ <format>igp</format>
+ <description>Interior gateway protocol origin</description>
+ </valueHelp>
+ <valueHelp>
+ <format>egp</format>
+ <description>Exterior gateway protocol origin</description>
+ </valueHelp>
+ <valueHelp>
+ <format>incomplete</format>
+ <description>Incomplete origin</description>
+ </valueHelp>
+ <constraint>
+ <regex>^(igp|egp|incomplete)$</regex>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="originator-id">
+ <properties>
+ <help>Border Gateway Protocol (BGP) originator ID attribute</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>Orignator IP address</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-host"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="src">
+ <properties>
+ <help>Source address for route</help>
+ <valueHelp>
+ <format>ipv4</format>
+ <description>IPv4 address</description>
+ </valueHelp>
+ <valueHelp>
+ <format>ipv6</format>
+ <description>IPv6 address</description>
+ </valueHelp>
+ <constraint>
+ <validator name="ipv4-host"/>
+ <validator name="ipv6-host"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="table">
+ <properties>
+ <help>Set prefixes to table</help>
+ <valueHelp>
+ <format>u32:1-200</format>
+ <description>Table value</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-200"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="tag">
+ <properties>
+ <help>Tag value for routing protocol</help>
+ <valueHelp>
+ <format>u32:1-65535</format>
+ <description>Tag value</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 1-65535"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ <leafNode name="weight">
+ <properties>
+ <help>Border Gateway Protocol (BGP) weight attribute</help>
+ <valueHelp>
+ <format>u32:0-4294967295</format>
+ <description>BGP weight</description>
+ </valueHelp>
+ <constraint>
+ <validator name="numeric" argument="--range 0-4294967295"/>
+ </constraint>
+ </properties>
+ </leafNode>
+ </children>
+ </node>
+ </children>
+ </tagNode>
+ </children>
+ </tagNode>
+ </children>
+ </node>
+</interfaceDefinition>
diff --git a/interface-definitions/protocols-bgp.xml.in b/interface-definitions/protocols-bgp.xml.in
index afcd8f727..d610f8dff 100644
--- a/interface-definitions/protocols-bgp.xml.in
+++ b/interface-definitions/protocols-bgp.xml.in
@@ -1,846 +1,16 @@
<?xml version="1.0"?>
-<!-- Border Gateway Protocol (BGP) configuration -->
<interfaceDefinition>
<node name="protocols">
<children>
- <tagNode name="bgp" owner="${vyos_conf_scripts_dir}/protocols_bgp.py">
+ <node name="bgp" owner="${vyos_conf_scripts_dir}/protocols_bgp.py">
<properties>
<help>Border Gateway Protocol (BGP)</help>
- <valueHelp>
- <format>u32:1-4294967294</format>
- <description>AS number</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-4294967294"/>
- </constraint>
<priority>820</priority>
</properties>
<children>
- <node name="address-family">
- <properties>
- <help>BGP address-family parameters</help>
- </properties>
- <children>
- <node name="ipv4-unicast">
- <properties>
- <help>IPv4 BGP settings</help>
- </properties>
- <children>
- <tagNode name="aggregate-address">
- <properties>
- <help>BGP aggregate network</help>
- <valueHelp>
- <format>ipv4net</format>
- <description>BGP aggregate network</description>
- </valueHelp>
- <constraint>
- <validator name="ipv4-prefix"/>
- </constraint>
- </properties>
- <children>
- #include <include/bgp-afi-aggregate-address.xml.i>
- </children>
- </tagNode>
- <tagNode name="network">
- <properties>
- <help>BGP network</help>
- <valueHelp>
- <format>ipv4net</format>
- <description>BGP network</description>
- </valueHelp>
- <constraint>
- <validator name="ipv4-prefix"/>
- </constraint>
- </properties>
- <children>
- <leafNode name="backdoor">
- <properties>
- <help>Network as a backdoor route</help>
- <valueless/>
- </properties>
- </leafNode>
- #include <include/bgp-route-map.xml.i>
- </children>
- </tagNode>
- #include <include/bgp-afi-maximum-paths.xml.i>
- <node name="redistribute">
- <properties>
- <help>Redistribute routes from other protocols into BGP</help>
- </properties>
- <children>
- <node name="connected">
- <properties>
- <help>Redistribute connected routes into BGP</help>
- </properties>
- <children>
- #include <include/bgp-afi-redistribute-metric-route-map.xml.i>
- </children>
- </node>
- <node name="isis">
- <properties>
- <help>Redistribute IS-IS routes into BGP</help>
- </properties>
- <children>
- #include <include/bgp-afi-redistribute-metric-route-map.xml.i>
- </children>
- </node>
- <node name="kernel">
- <properties>
- <help>Redistribute kernel routes into BGP</help>
- </properties>
- <children>
- #include <include/bgp-afi-redistribute-metric-route-map.xml.i>
- </children>
- </node>
- <node name="ospf">
- <properties>
- <help>Redistribute OSPF routes into BGP</help>
- </properties>
- <children>
- #include <include/bgp-afi-redistribute-metric-route-map.xml.i>
- </children>
- </node>
- <node name="rip">
- <properties>
- <help>Redistribute RIP routes into BGP</help>
- </properties>
- <children>
- #include <include/bgp-afi-redistribute-metric-route-map.xml.i>
- </children>
- </node>
- <node name="static">
- <properties>
- <help>Redistribute static routes into BGP</help>
- </properties>
- <children>
- #include <include/bgp-afi-redistribute-metric-route-map.xml.i>
- </children>
- </node>
- <leafNode name="table">
- <properties>
- <help>Redistribute non-main Kernel Routing Table</help>
- </properties>
- </leafNode>
- </children>
- </node>
- </children>
- </node>
- <node name="ipv6-unicast">
- <properties>
- <help>IPv6 BGP settings</help>
- </properties>
- <children>
- <tagNode name="aggregate-address">
- <properties>
- <help>BGP aggregate network</help>
- <valueHelp>
- <format>ipv6net</format>
- <description>Aggregate network</description>
- </valueHelp>
- <constraint>
- <validator name="ipv6-prefix"/>
- </constraint>
- </properties>
- <children>
- #include <include/bgp-afi-aggregate-address.xml.i>
- </children>
- </tagNode>
- <tagNode name="network">
- <properties>
- <help>BGP network</help>
- <valueHelp>
- <format>ipv6net</format>
- <description>Aggregate network</description>
- </valueHelp>
- <constraint>
- <validator name="ipv6-prefix"/>
- </constraint>
- </properties>
- <children>
- <leafNode name="path-limit">
- <properties>
- <help>AS-path hopcount limit</help>
- <valueHelp>
- <format>u32:0-255</format>
- <description>AS path hop count limit</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-255"/>
- </constraint>
- </properties>
- </leafNode>
- #include <include/bgp-route-map.xml.i>
- </children>
- </tagNode>
- #include <include/bgp-afi-maximum-paths.xml.i>
- <node name="redistribute">
- <properties>
- <help>Redistribute routes from other protocols into BGP</help>
- </properties>
- <children>
- <node name="connected">
- <properties>
- <help>Redistribute connected routes into BGP</help>
- </properties>
- <children>
- #include <include/bgp-afi-redistribute-metric-route-map.xml.i>
- </children>
- </node>
- <node name="kernel">
- <properties>
- <help>Redistribute kernel routes into BGP</help>
- </properties>
- <children>
- #include <include/bgp-afi-redistribute-metric-route-map.xml.i>
- </children>
- </node>
- <node name="ospfv3">
- <properties>
- <help>Redistribute OSPFv3 routes into BGP</help>
- </properties>
- <children>
- #include <include/bgp-afi-redistribute-metric-route-map.xml.i>
- </children>
- </node>
- <node name="ripng">
- <properties>
- <help>Redistribute RIPng routes into BGP</help>
- </properties>
- <children>
- #include <include/bgp-afi-redistribute-metric-route-map.xml.i>
- </children>
- </node>
- <node name="static">
- <properties>
- <help>Redistribute static routes into BGP</help>
- </properties>
- <children>
- #include <include/bgp-afi-redistribute-metric-route-map.xml.i>
- </children>
- </node>
- <leafNode name="table">
- <properties>
- <help>Redistribute non-main Kernel Routing Table</help>
- </properties>
- </leafNode>
- </children>
- </node>
- </children>
- </node>
- <node name="l2vpn-evpn">
- <properties>
- <help>L2VPN EVPN BGP settings</help>
- </properties>
- <children>
- <leafNode name="advertise-all-vni">
- <properties>
- <help>Advertise All local VNIs</help>
- <valueless/>
- </properties>
- </leafNode>
- #include <include/bgp-afi-l2vpn-common.xml.i>
- <leafNode name="advertise-pip">
- <properties>
- <help>EVPN system primary IP</help>
- <valueHelp>
- <format>ipv4</format>
- <description>IP address</description>
- </valueHelp>
- <constraint>
- <validator name="ipv4-address"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="rt-auto-derive">
- <properties>
- <help>Auto derivation of Route Target (RFC8365)</help>
- <valueless/>
- </properties>
- </leafNode>
- <node name="flooding">
- <properties>
- <help>Specify handling for BUM packets</help>
- </properties>
- <children>
- <leafNode name="disable">
- <properties>
- <help>Do not flood any BUM packets</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="head-end-replication">
- <properties>
- <help>Flood BUM packets using head-end replication</help>
- <valueless/>
- </properties>
- </leafNode>
- </children>
- </node>
- <tagNode name="vni">
- <properties>
- <help>VXLAN Network Identifier</help>
- <valueHelp>
- <format>u32:1-16777215</format>
- <description>VNI number</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-16777215"/>
- </constraint>
- </properties>
- <children>
- #include <include/bgp-afi-l2vpn-common.xml.i>
- </children>
- </tagNode>
- </children>
- </node>
- </children>
- </node>
- <node name="listen">
- <properties>
- <help>Listen for and accept BGP dynamic neighbors from range</help>
- </properties>
- <children>
- <leafNode name="limit">
- <properties>
- <help>Maximum number of dynamic neighbors that can be created</help>
- <valueHelp>
- <format>u32:1-5000</format>
- <description>BGP neighbor limit</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-5000"/>
- </constraint>
- </properties>
- </leafNode>
- <tagNode name="range">
- <properties>
- <help>BGP dynamic neighbors listen range</help>
- <valueHelp>
- <format>ipv4net</format>
- <description>IPv4 dynamic neighbors listen range</description>
- </valueHelp>
- <valueHelp>
- <format>ipv6net</format>
- <description>IPv6 dynamic neighbors listen range</description>
- </valueHelp>
- <constraint>
- <validator name="ipv4-prefix"/>
- <validator name="ipv6-prefix"/>
- </constraint>
- </properties>
- <children>
- #include <include/bgp-peer-group.xml.i>
- </children>
- </tagNode>
- </children>
- </node>
- <tagNode name="neighbor">
- <properties>
- <help>BGP neighbor</help>
- <valueHelp>
- <format>ipv4</format>
- <description>BGP neighbor IP address</description>
- </valueHelp>
- <valueHelp>
- <format>ipv6</format>
- <description>BGP neighbor IPv6 address</description>
- </valueHelp>
- <valueHelp>
- <format>txt</format>
- <description>Interface name</description>
- </valueHelp>
- <constraint>
- <validator name="ipv4-address"/>
- <validator name="ipv6-address"/>
- <validator name="interface-name"/>
- </constraint>
- </properties>
- <children>
- <node name="address-family">
- <properties>
- <help>Parameters relating to IPv4 or IPv6 routes</help>
- </properties>
- <children>
- #include <include/bgp-neighbor-afi-ipv4-unicast.xml.i>
- #include <include/bgp-neighbor-afi-ipv6-unicast.xml.i>
- #include <include/bgp-neighbor-afi-l2vpn-evpn.xml.i>
- </children>
- </node>
- <leafNode name="advertisement-interval">
- <properties>
- <help>Minimum interval for sending routing updates</help>
- <valueHelp>
- <format>u32:0-600</format>
- <description>Advertisement interval in seconds</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-600"/>
- </constraint>
- </properties>
- </leafNode>
- #include <include/bgp-bfd.xml.i>
- #include <include/bgp-capability.xml.i>
- #include <include/bgp-description.xml.i>
- #include <include/bgp-disable-capability-negotiation.xml.i>
- #include <include/bgp-disable-connected-check.xml.i>
- #include <include/bgp-ebgp-multihop.xml.i>
- <node name="interface">
- <properties>
- <help>Interface parameters</help>
- </properties>
- <children>
- #include <include/bgp-peer-group.xml.i>
- #include <include/bgp-remote-as.xml.i>
- <node name="v6only">
- <properties>
- <help>Enable BGP with v6 link-local only</help>
- </properties>
- <children>
- #include <include/bgp-peer-group.xml.i>
- #include <include/bgp-remote-as.xml.i>
- </children>
- </node>
- </children>
- </node>
- #include <include/bgp-local-as.xml.i>
- #include <include/bgp-override-capability.xml.i>
- #include <include/bgp-passive.xml.i>
- #include <include/bgp-password.xml.i>
- #include <include/bgp-peer-group.xml.i>
- <leafNode name="port">
- <properties>
- <help>Neighbor BGP port</help>
- <valueHelp>
- <format>u32:1-65535</format>
- <description>Neighbor BGP port number</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-65535"/>
- </constraint>
- </properties>
- </leafNode>
- #include <include/bgp-remote-as.xml.i>
- #include <include/bgp-shutdown.xml.i>
- <leafNode name="strict-capability-match">
- <properties>
- <help>Enable strict capability negotiation</help>
- <valueless/>
- </properties>
- </leafNode>
- <node name="timers">
- <properties>
- <help>Neighbor timers</help>
- </properties>
- <children>
- <leafNode name="connect">
- <properties>
- <help>BGP connect timer for this neighbor</help>
- <valueHelp>
- <format>u32:1-65535</format>
- <description>Connect timer in seconds</description>
- </valueHelp>
- <valueHelp>
- <format>0</format>
- <description>Disable connect timer</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-65535"/>
- </constraint>
- </properties>
- </leafNode>
- #include <include/bgp-timers-holdtime.xml.i>
- #include <include/bgp-timers-keepalive.xml.i>
- </children>
- </node>
- #include <include/bgp-ttl-security.xml.i>
- #include <include/bgp-update-source.xml.i>
- </children>
- </tagNode>
- <node name="parameters">
- <properties>
- <help>BGP parameters</help>
- </properties>
- <children>
- <leafNode name="always-compare-med">
- <properties>
- <help>Always compare MEDs from different neighbors</help>
- <valueless/>
- </properties>
- </leafNode>
- <node name="bestpath">
- <properties>
- <help>Default bestpath selection mechanism</help>
- </properties>
- <children>
- <node name="as-path">
- <properties>
- <help>AS-path attribute comparison parameters</help>
- </properties>
- <children>
- <leafNode name="confed">
- <properties>
- <help>Compare AS-path lengths including confederation sets and sequences</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="ignore">
- <properties>
- <help>Ignore AS-path length in selecting a route</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="multipath-relax">
- <properties>
- <help>Allow load sharing across routes that have different AS paths (but same length)</help>
- <valueless/>
- </properties>
- </leafNode>
- </children>
- </node>
- <leafNode name="compare-routerid">
- <properties>
- <help>Compare the router-id for identical EBGP paths</help>
- <valueless/>
- </properties>
- </leafNode>
- <node name="med">
- <properties>
- <help>MED attribute comparison parameters</help>
- </properties>
- <children>
- <leafNode name="confed">
- <properties>
- <help>Compare MEDs among confederation paths</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="missing-as-worst">
- <properties>
- <help>Treat missing route as a MED as the least preferred one</help>
- <valueless/>
- </properties>
- </leafNode>
- </children>
- </node>
- </children>
- </node>
- <leafNode name="cluster-id">
- <properties>
- <help>Route-reflector cluster-id</help>
- <valueHelp>
- <format>ipv4</format>
- <description>Route-reflector cluster-id</description>
- </valueHelp>
- <constraint>
- <validator name="ipv4-address"/>
- </constraint>
- </properties>
- </leafNode>
- <node name="confederation">
- <properties>
- <help>AS confederation parameters</help>
- </properties>
- <children>
- <leafNode name="identifier">
- <properties>
- <help>Confederation AS identifier [REQUIRED]</help>
- <valueHelp>
- <format>u32:1-4294967294</format>
- <description>Confederation AS id</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-4294967294"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="peers">
- <properties>
- <help>Peer ASs in the BGP confederation</help>
- <valueHelp>
- <format>u32:1-4294967294</format>
- <description>Peer AS number</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-4294967294"/>
- </constraint>
- </properties>
- </leafNode>
- </children>
- </node>
- <node name="dampening">
- <properties>
- <help>Enable route-flap dampening</help>
- </properties>
- <children>
- <leafNode name="half-life">
- <properties>
- <help>Half-life time for dampening [REQUIRED]</help>
- <valueHelp>
- <format>u32:1-45</format>
- <description>Half-life penalty in minutes</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-45"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="max-suppress-time">
- <properties>
- <help>Maximum duration to suppress a stable route [REQUIRED]</help>
- <valueHelp>
- <format>u32:1-255</format>
- <description>Maximum suppress duration in minutes</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-255"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="re-use">
- <properties>
- <help>Threshold to start reusing a route [REQUIRED]</help>
- <valueHelp>
- <format>u32:1-20000</format>
- <description>Re-use penalty points</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-20000"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="start-suppress-time">
- <properties>
- <help>When to start suppressing a route [REQUIRED]</help>
- <valueHelp>
- <format>u32:1-20000</format>
- <description>Start-suppress penalty points</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-20000"/>
- </constraint>
- </properties>
- </leafNode>
- </children>
- </node>
- <node name="default">
- <properties>
- <help>BGP defaults</help>
- </properties>
- <children>
- <leafNode name="local-pref">
- <properties>
- <help>Default local preference</help>
- <valueHelp>
- <format>u32</format>
- <description>Local preference</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-4294967295"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="no-ipv4-unicast">
- <properties>
- <help>Deactivate IPv4 unicast for a peer by default</help>
- <valueless/>
- </properties>
- </leafNode>
- </children>
- </node>
- <leafNode name="deterministic-med">
- <properties>
- <help>Compare MEDs between different peers in the same AS</help>
- <valueless/>
- </properties>
- </leafNode>
- <node name="distance">
- <properties>
- <help>Administratives distances for BGP routes</help>
- </properties>
- <children>
- <node name="global">
- <properties>
- <help>Global administratives distances for BGP routes</help>
- </properties>
- <children>
- <leafNode name="external">
- <properties>
- <help>Administrative distance for external BGP routes</help>
- <valueHelp>
- <format>u32:1-255</format>
- <description>Administrative distance for external BGP routes</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-255"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="internal">
- <properties>
- <help>Administrative distance for internal BGP routes</help>
- <valueHelp>
- <format>u32:1-255</format>
- <description>Administrative distance for internal BGP routes</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-255"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="local">
- <properties>
- <help>Administrative distance for local BGP routes</help>
- <valueHelp>
- <format>u32:1-255</format>
- <description>Administrative distance for internal BGP routes</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-255"/>
- </constraint>
- </properties>
- </leafNode>
- </children>
- </node>
- <tagNode name="prefix">
- <properties>
- <help>Administrative distance for a specific BGP prefix</help>
- <valueHelp>
- <format>ipv4net</format>
- <description>Administrative distance for a specific BGP prefix</description>
- </valueHelp>
- <constraint>
- <validator name="ipv4-prefix"/>
- </constraint>
- </properties>
- <children>
- <leafNode name="distance">
- <properties>
- <help>Administrative distance for prefix</help>
- <valueHelp>
- <format>u32:1-255</format>
- <description>Administrative distance for external BGP routes</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-255"/>
- </constraint>
- </properties>
- </leafNode>
- </children>
- </tagNode>
- </children>
- </node>
- <leafNode name="ebgp-requires-policy">
- <properties>
- <help>Require in and out policy for eBGP peers (RFC8212)</help>
- <valueless/>
- </properties>
- </leafNode>
- <node name="graceful-restart">
- <properties>
- <help>Graceful restart capability parameters</help>
- </properties>
- <children>
- <leafNode name="stalepath-time">
- <properties>
- <help>Maximum time to hold onto restarting neighbors stale paths</help>
- <valueHelp>
- <format>u32:1-3600</format>
- <description>Hold time in seconds</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-3600"/>
- </constraint>
- </properties>
- </leafNode>
- </children>
- </node>
- <leafNode name="graceful-shutdown">
- <properties>
- <help>Graceful shutdown</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="log-neighbor-changes">
- <properties>
- <help>Log neighbor up/down changes and reset reason</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="network-import-check">
- <properties>
- <help>Enable IGP route check for network statements</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="no-client-to-client-reflection">
- <properties>
- <help>Disable client to client route reflection</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="no-fast-external-failover">
- <properties>
- <help>Disable immediate session reset on peer link down event</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="router-id">
- <properties>
- <help>BGP router id</help>
- <valueHelp>
- <format>ipv4</format>
- <description>BGP router id</description>
- </valueHelp>
- <constraint>
- <validator name="ipv4-address"/>
- </constraint>
- </properties>
- </leafNode>
- </children>
- </node>
- <tagNode name="peer-group">
- <properties>
- <help>BGP peer-group</help>
- </properties>
- <children>
- <node name="address-family">
- <properties>
- <help>BGP peer-group address-family parameters</help>
- </properties>
- <children>
- #include <include/bgp-neighbor-afi-ipv4-unicast.xml.i>
- #include <include/bgp-neighbor-afi-ipv6-unicast.xml.i>
- #include <include/bgp-neighbor-afi-l2vpn-evpn.xml.i>
- </children>
- </node>
- #include <include/bgp-bfd.xml.i>
- #include <include/bgp-capability.xml.i>
- #include <include/bgp-description.xml.i>
- #include <include/bgp-disable-capability-negotiation.xml.i>
- #include <include/bgp-disable-connected-check.xml.i>
- #include <include/bgp-ebgp-multihop.xml.i>
- #include <include/bgp-local-as.xml.i>
- #include <include/bgp-override-capability.xml.i>
- #include <include/bgp-passive.xml.i>
- #include <include/bgp-password.xml.i>
- #include <include/bgp-remote-as.xml.i>
- #include <include/bgp-shutdown.xml.i>
- #include <include/bgp-ttl-security.xml.i>
- #include <include/bgp-update-source.xml.i>
- </children>
- </tagNode>
- #include <include/bgp-route-map.xml.i>
- <node name="timers">
- <properties>
- <help>BGP protocol timers</help>
- </properties>
- <children>
- #include <include/bgp-timers-holdtime.xml.i>
- #include <include/bgp-timers-keepalive.xml.i>
- </children>
- </node>
+ #include <include/bgp/bgp-common-config.xml.i>
</children>
- </tagNode>
+ </node>
</children>
</node>
</interfaceDefinition>
diff --git a/interface-definitions/protocols-isis.xml.in b/interface-definitions/protocols-isis.xml.in
index 4ac378977..1bc890446 100644
--- a/interface-definitions/protocols-isis.xml.in
+++ b/interface-definitions/protocols-isis.xml.in
@@ -1,782 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Protocol IS-IS configuration -->
<interfaceDefinition>
<node name="protocols">
<children>
- <tagNode name="isis" owner="${vyos_conf_scripts_dir}/protocols_isis.py">
+ <node name="isis" owner="${vyos_conf_scripts_dir}/protocols_isis.py">
<properties>
<help>Intermediate System to Intermediate System (IS-IS)</help>
- <valueHelp>
- <format>text(TAG)</format>
- <description>ISO Routing area tag</description>
- </valueHelp>
+ <priority>610</priority>
</properties>
<children>
- <node name="area-password">
- <properties>
- <help>Configure the authentication password for an area</help>
- </properties>
- <children>
- <leafNode name="plaintext-password">
- <properties>
- <help>Plain-text authentication type</help>
- <valueHelp>
- <format>txt</format>
- <description>Level-wide password</description>
- </valueHelp>
- </properties>
- </leafNode>
- <leafNode name="md5">
- <properties>
- <help>MD5 authentication type</help>
- <valueHelp>
- <format>txt</format>
- <description>Level-wide password</description>
- </valueHelp>
- </properties>
- </leafNode>
- </children>
- </node>
- <node name="default-information">
- <properties>
- <help>Control distribution of default information</help>
- </properties>
- <children>
- <node name="originate">
- <properties>
- <help>Distribute a default route</help>
- </properties>
- <children>
- <node name="ipv4">
- <properties>
- <help>Distribute default route for IPv4</help>
- </properties>
- <children>
- <leafNode name="level-1">
- <properties>
- <help>Distribute default route into level-1</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="level-2">
- <properties>
- <help>Distribute default route into level-2</help>
- <valueless/>
- </properties>
- </leafNode>
- </children>
- </node>
- <node name="ipv6">
- <properties>
- <help>Distribute default route for IPv6</help>
- </properties>
- <children>
- <leafNode name="level-1">
- <properties>
- <help>Distribute default route into level-1</help>
- <completionHelp>
- <list>always</list>
- </completionHelp>
- <valueHelp>
- <format>always</format>
- <description>Always advertise default route</description>
- </valueHelp>
- </properties>
- </leafNode>
- <leafNode name="level-2">
- <properties>
- <help>Distribute default route into level-2</help>
- <completionHelp>
- <list>always</list>
- </completionHelp>
- <valueHelp>
- <format>always</format>
- <description>Always advertise default route</description>
- </valueHelp>
- </properties>
- </leafNode>
- </children>
- </node>
- </children>
- </node>
- </children>
- </node>
- <node name="domain-password">
- <properties>
- <help>Set the authentication password for a routing domain</help>
- </properties>
- <children>
- <leafNode name="plaintext-password">
- <properties>
- <help>Plain-text authentication type</help>
- <valueHelp>
- <format>txt</format>
- <description>Level-wide password</description>
- </valueHelp>
- </properties>
- </leafNode>
-<!--
- <leafNode name="md5">
- <properties>
- <help>MD5 authentication type</help>
- <valueHelp>
- <format>txt</format>
- <description>Level-wide password</description>
- </valueHelp>
- </properties>
- </leafNode>
--->
- </children>
- </node>
- <leafNode name="dynamic-hostname">
- <properties>
- <help>Dynamic hostname for IS-IS</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="level">
- <properties>
- <help>IS-IS level number</help>
- <completionHelp>
- <list>level-1 level-1-2 level-2</list>
- </completionHelp>
- <valueHelp>
- <format>level-1</format>
- <description>Act as a station router</description>
- </valueHelp>
- <valueHelp>
- <format>level-1-2</format>
- <description>Act as both a station and an area router</description>
- </valueHelp>
- <valueHelp>
- <format>level-2</format>
- <description>Act as an area router</description>
- </valueHelp>
- <constraint>
- <regex>(level-1|level-1-2|level-2)</regex>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="lsp-gen-interval">
- <properties>
- <help>Minimum interval between regenerating same LSP</help>
- <valueHelp>
- <format>u32:1-120</format>
- <description>Minimum interval in seconds</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-120"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="lsp-mtu">
- <properties>
- <help>Configure the maximum size of generated LSPs</help>
- <valueHelp>
- <format>u32:128-4352</format>
- <description>Maximum size of generated LSPs</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 128-4352"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="lsp-refresh-interval">
- <properties>
- <help>LSP refresh interval</help>
- <valueHelp>
- <format>u32:1-65235</format>
- <description>LSP refresh interval in seconds</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-65235"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="max-lsp-lifetime">
- <properties>
- <help>Maximum LSP lifetime</help>
- <valueHelp>
- <format>u32:350-65535</format>
- <description>LSP lifetime in seconds</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-65535"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="metric-style">
- <properties>
- <help>Use old-style (ISO 10589) or new-style packet formats</help>
- <completionHelp>
- <list>narrow transition wide</list>
- </completionHelp>
- <valueHelp>
- <format>narrow</format>
- <description>Use old style of TLVs with narrow metric</description>
- </valueHelp>
- <valueHelp>
- <format>transition</format>
- <description>Send and accept both styles of TLVs during transition</description>
- </valueHelp>
- <valueHelp>
- <format>wide</format>
- <description>Use new style of TLVs to carry wider metric</description>
- </valueHelp>
- <constraint>
- <regex>(narrow|transition|wide)</regex>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="net">
- <properties>
- <help>A Network Entity Title for this process (ISO only)</help>
- <valueHelp>
- <format>XX.XXXX. ... .XXX.XX</format>
- <description>Network entity title (NET)</description>
- </valueHelp>
- <constraint>
- <regex>[a-fA-F0-9]{2}(\.[a-fA-F0-9]{4}){3,9}\.[a-fA-F0-9]{2}</regex>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="purge-originator">
- <properties>
- <help>Use the RFC 6232 purge-originator</help>
- <valueless/>
- </properties>
- </leafNode>
- <node name="traffic-engineering">
- <properties>
- <help>Show IS-IS neighbor adjacencies</help>
- </properties>
- <children>
- <leafNode name="enable">
- <properties>
- <help>Enable MPLS traffic engineering extensions</help>
- <valueless/>
- </properties>
- </leafNode>
-<!--
- <node name="inter-as">
- <properties>
- <help>MPLS traffic engineering inter-AS support</help>
- </properties>
- <children>
- <leafNode name="level-1">
- <properties>
- <help>Area native mode self originate inter-AS LSP with L1 only flooding scope</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="level-1-2">
- <properties>
- <help>Area native mode self originate inter-AS LSP with L1 and L2 flooding scope</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="level-2">
- <properties>
- <help>Area native mode self originate inter-AS LSP with L2 only flooding scope</help>
- <valueless/>
- </properties>
- </leafNode>
- </children>
- </node>
- <leafNode name="inter-as">
- <properties>
- <help>MPLS traffic engineering inter-AS support</help>
- <valueless/>
- </properties>
- </leafNode>
--->
- <leafNode name="address">
- <properties>
- <help>MPLS traffic engineering router ID</help>
- <valueHelp>
- <format>ipv4</format>
- <description>IPv4 address</description>
- </valueHelp>
- <constraint>
- <validator name="ipv4-address"/>
- </constraint>
- </properties>
- </leafNode>
- </children>
- </node>
- <node name="segment-routing">
- <properties>
- <help>Segment-Routing (SPRING) settings</help>
- </properties>
- <children>
- <leafNode name="enable">
- <properties>
- <help>Enable segment-routing functionality</help>
- <valueless/>
- </properties>
- </leafNode>
- <node name="global-block">
- <properties>
- <help>Global block label range</help>
- </properties>
- <children>
- <leafNode name="low-label-value">
- <properties>
- <help>The lower bound of the global block</help>
- <valueHelp>
- <format>u32:16-1048575</format>
- <description>MPLS label value</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 16-1048575"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="high-label-value">
- <properties>
- <help>The upper bound of the global block</help>
- <valueHelp>
- <format>u32:16-1048575</format>
- <description>MPLS label value</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 16-1048575"/>
- </constraint>
- </properties>
- </leafNode>
- </children>
- </node>
-<!--
- <node name="local-block">
- <properties>
- <help>Local Block label range</help>
- </properties>
- <children>
- <leafNode name="low-label-value">
- <properties>
- <help>The lower bound of the local block</help>
- <valueHelp>
- <format>u32:16-1048575</format>
- <description>MPLS label value</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument=" range 16-1048575"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="high-label-value">
- <properties>
- <help>The upper bound of the local block</help>
- <valueHelp>
- <format>u32:16-1048575</format>
- <description>MPLS label value</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument=" range 16-1048575"/>
- </constraint>
- </properties>
- </leafNode>
- </children>
- </node>
--->
- <leafNode name="maximum-label-depth">
- <properties>
- <help>Maximum MPLS labels allowed for this router</help>
- <valueHelp>
- <format>u32:1-16</format>
- <description>MPLS label depth</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-16"/>
- </constraint>
- </properties>
- </leafNode>
- <tagNode name="prefix">
- <properties>
- <help>Static IPv4/IPv6 prefix segment/label mapping</help>
- <valueHelp>
- <format>ipv4net</format>
- <description>IPv4 prefix segment</description>
- </valueHelp>
- <valueHelp>
- <format>ipv6net</format>
- <description>IPv6 prefix segment</description>
- </valueHelp>
- <constraint>
- <validator name="ipv4-prefix"/>
- <validator name="ipv6-prefix"/>
- </constraint>
- </properties>
- <children>
- <node name="absolute">
- <properties>
- <help>Specify the absolute value of prefix segment/label ID</help>
- </properties>
- <children>
- <leafNode name="value">
- <properties>
- <help>Specify the absolute value of prefix segment/label ID</help>
- <valueHelp>
- <format>u32:16-1048575</format>
- <description>The absolute segment/label ID value</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 16-1048575"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="explicit-null">
- <properties>
- <help>Request upstream neighbor to replace segment/label with explicit null label</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="no-php-flag">
- <properties>
- <help>Do not request penultimate hop popping for segment/label</help>
- <valueless/>
- </properties>
- </leafNode>
- </children>
- </node>
- <node name="index">
- <properties>
- <help>Specify the index value of prefix segment/label ID</help>
- </properties>
- <children>
- <leafNode name="value">
- <properties>
- <help>Specify the index value of prefix segment/label ID</help>
- <valueHelp>
- <format>u32:0-65535</format>
- <description>The index segment/label ID value</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-65535"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="explicit-null">
- <properties>
- <help>Request upstream neighbor to replace segment/label with explicit null label</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="no-php-flag">
- <properties>
- <help>Do not request penultimate hop popping for segment/label</help>
- <valueless/>
- </properties>
- </leafNode>
- </children>
- </node>
- </children>
- </tagNode>
- </children>
- </node>
- <node name="redistribute">
- <properties>
- <help>Redistribute information from another routing protocol</help>
- </properties>
- <children>
- <node name="ipv4">
- <properties>
- <help>Redistribute IPv4 routes</help>
- </properties>
- <children>
- <node name="bgp">
- <properties>
- <help>Border Gateway Protocol (BGP)</help>
- </properties>
- <children>
- #include <include/isis-redistribute-ipv4.xml.i>
- </children>
- </node>
- <node name="connected">
- <properties>
- <help>Redistribute connected routes into IS-IS</help>
- </properties>
- <children>
- #include <include/isis-redistribute-ipv4.xml.i>
- </children>
- </node>
- <node name="kernel">
- <properties>
- <help>Redistribute kernel routes into IS-IS</help>
- </properties>
- <children>
- #include <include/isis-redistribute-ipv4.xml.i>
- </children>
- </node>
- <node name="ospf">
- <properties>
- <help>Redistribute OSPF routes into IS-IS</help>
- </properties>
- <children>
- #include <include/isis-redistribute-ipv4.xml.i>
- </children>
- </node>
- <node name="rip">
- <properties>
- <help>Redistribute RIP routes into IS-IS</help>
- </properties>
- <children>
- #include <include/isis-redistribute-ipv4.xml.i>
- </children>
- </node>
- <node name="static">
- <properties>
- <help>Redistribute static routes into IS-IS</help>
- </properties>
- <children>
- #include <include/isis-redistribute-ipv4.xml.i>
- </children>
- </node>
- </children>
- </node>
- </children>
- </node>
- <leafNode name="set-attached-bit">
- <properties>
- <help>Set attached bit to identify as L1/L2 router for inter-area traffic</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="set-overload-bit">
- <properties>
- <help>Set overload bit to avoid any transit traffic</help>
- <valueless/>
- </properties>
- </leafNode>
- <node name="spf-delay-ietf">
- <properties>
- <help>IETF SPF delay algorithm</help>
- </properties>
- <children>
- <leafNode name="init-delay">
- <properties>
- <help>Delay used while in QUIET state</help>
- <valueHelp>
- <format>u32:0-60000</format>
- <description>Delay used while in QUIET state (in ms)</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-60000"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="short-delay">
- <properties>
- <help>Delay used while in SHORT_WAIT state</help>
- <valueHelp>
- <format>u32:0-60000</format>
- <description>Delay used while in SHORT_WAIT state (in ms)</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-60000"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="long-delay">
- <properties>
- <help>Delay used while in LONG_WAIT</help>
- <valueHelp>
- <format>u32:0-60000</format>
- <description>Delay used while in LONG_WAIT state (in ms)</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-60000"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="holddown">
- <properties>
- <help>Time with no received IGP events before considering IGP stable</help>
- <valueHelp>
- <format>u32:0-60000</format>
- <description>Time with no received IGP events before considering IGP stable (in ms)</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-60000"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="time-to-learn">
- <properties>
- <help>Maximum duration needed to learn all the events related to a single failure</help>
- <valueHelp>
- <format>u32:0-60000</format>
- <description>Maximum duration needed to learn all the events related to a single failure (in ms)</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-60000"/>
- </constraint>
- </properties>
- </leafNode>
- </children>
- </node>
- <leafNode name="spf-interval">
- <properties>
- <help>Minimum interval between SPF calculations</help>
- <valueHelp>
- <format>u32:1-120</format>
- <description>Minimum interval between consecutive SPFs in seconds</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-120"/>
- </constraint>
- </properties>
- </leafNode>
- <tagNode name="interface">
- <!-- (config-if)# ip router isis WORD (same as name of IS-IS process)
- if any section of "interface" pesent -->
- <properties>
- <help>Interface params</help>
- <completionHelp>
- <script>${vyos_completion_dir}/list_interfaces.py</script>
- </completionHelp>
- </properties>
- <children>
- <leafNode name="bfd">
- <properties>
- <help>Enable BFD support</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="circuit-type">
- <properties>
- <help>Configure circuit type for interface</help>
- <completionHelp>
- <list>level-1 level-1-2 level-2-only</list>
- </completionHelp>
- <valueHelp>
- <format>level-1</format>
- <description>Level-1 only adjacencies are formed</description>
- </valueHelp>
- <valueHelp>
- <format>level-1-2</format>
- <description>Level-1-2 adjacencies are formed</description>
- </valueHelp>
- <valueHelp>
- <format>level-2-only</format>
- <description>Level-2 only adjacencies are formed</description>
- </valueHelp>
- <constraint>
- <regex>(level-1|level-1-2|level-2-only)</regex>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="hello-padding">
- <properties>
- <help>Add padding to IS-IS hello packets</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="hello-interval">
- <properties>
- <help>Set Hello interval</help>
- <valueHelp>
- <format>u32:1-600</format>
- <description>Set Hello interval</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-600"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="hello-multiplier">
- <properties>
- <help>Set Hello interval</help>
- <valueHelp>
- <format>u32:2-100</format>
- <description>Set multiplier for Hello holding time</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 2-100"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="metric">
- <properties>
- <help>Set default metric for circuit</help>
- <valueHelp>
- <format>u32:0-16777215</format>
- <description>Default metric value</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-16777215"/>
- </constraint>
- </properties>
- </leafNode>
- <node name="network">
- <properties>
- <help>Set network type</help>
- </properties>
- <children>
- <leafNode name="point-to-point">
- <properties>
- <help>point-to-point network type</help>
- <valueless/>
- </properties>
- </leafNode>
- </children>
- </node>
- <leafNode name="passive">
- <properties>
- <help>Configure the passive mode for interface</help>
- <valueless/>
- </properties>
- </leafNode>
- <node name="password">
- <properties>
- <help>Configure the authentication password for a circuit</help>
- </properties>
- <children>
- <leafNode name="plaintext-password">
- <properties>
- <help>Plain-text authentication type</help>
- <valueHelp>
- <format>txt</format>
- <description>Circuit password</description>
- </valueHelp>
- </properties>
- </leafNode>
- </children>
- </node>
- <leafNode name="priority">
- <properties>
- <help>Set priority for Designated Router election</help>
- <valueHelp>
- <format>u32:0-127</format>
- <description>Priority value</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-127"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="psnp-interval">
- <properties>
- <help>Set PSNP interval in seconds</help>
- <valueHelp>
- <format>u32:0-127</format>
- <description>Priority value</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-127"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="no-three-way-handshake">
- <properties>
- <help>Disable three-way handshake</help>
- <valueless/>
- </properties>
- </leafNode>
- </children>
- </tagNode>
+ #include <include/isis/isis-common-config.xml.i>
</children>
- </tagNode>
+ </node>
</children>
</node>
</interfaceDefinition>
diff --git a/interface-definitions/protocols-ospf.xml.in b/interface-definitions/protocols-ospf.xml.in
index b9c9fcc04..d9c3325ec 100644
--- a/interface-definitions/protocols-ospf.xml.in
+++ b/interface-definitions/protocols-ospf.xml.in
@@ -1,5 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
-<!-- Protocol OSPF configuration -->
<interfaceDefinition>
<node name="protocols">
<children>
@@ -9,822 +8,7 @@
<priority>620</priority>
</properties>
<children>
- <tagNode name="access-list">
- <properties>
- <help>Access list to filter networks in routing updates</help>
- <completionHelp>
- <path>policy access-list</path>
- </completionHelp>
- <valueHelp>
- <format>u32</format>
- <description>Access-list number</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-4294967295"/>
- </constraint>
- </properties>
- <children>
- <leafNode name="export">
- <properties>
- <help>Filter for outgoing routing update [REQUIRED]</help>
- <completionHelp>
- <list>bgp connected kernel rip static</list>
- </completionHelp>
- <valueHelp>
- <format>bgp</format>
- <description>Filter BGP routes</description>
- </valueHelp>
- <valueHelp>
- <format>connected</format>
- <description>Filter connected routes</description>
- </valueHelp>
- <valueHelp>
- <format>isis</format>
- <description>Filter IS-IS routes</description>
- </valueHelp>
- <valueHelp>
- <format>kernel</format>
- <description>Filter Kernel routes</description>
- </valueHelp>
- <valueHelp>
- <format>rip</format>
- <description>Filter RIP routes</description>
- </valueHelp>
- <valueHelp>
- <format>static</format>
- <description>Filter static routes</description>
- </valueHelp>
- <constraint>
- <regex>^(bgp|connected|isis|kernel|rip|static)$</regex>
- </constraint>
- <constraintErrorMessage>Must be bgp, connected, kernel, rip, or static</constraintErrorMessage>
- <multi/>
- </properties>
- </leafNode>
- </children>
- </tagNode>
- <tagNode name="area">
- <properties>
- <help>OSPF Area</help>
- <valueHelp>
- <format>u32</format>
- <description>OSPF area in decimal notation</description>
- </valueHelp>
- <valueHelp>
- <format>ipv4</format>
- <description>OSPF area in dotted decimal notation</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-4294967295"/>
- <validator name="ip-address"/>
- </constraint>
- </properties>
- <children>
- <node name="area-type">
- <properties>
- <help>Area type</help>
- </properties>
- <children>
- <leafNode name="normal">
- <properties>
- <help>Normal OSPF area</help>
- <valueless/>
- </properties>
- </leafNode>
- <node name="nssa">
- <properties>
- <help>Nssa OSPF area</help>
- </properties>
- <children>
- <leafNode name="default-cost">
- <properties>
- <help>Summary-default cost of nssa area</help>
- <valueHelp>
- <format>u32:0-16777215</format>
- <description>Summary default cost</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-16777215"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="no-summary">
- <properties>
- <help>Do not inject inter-area routes into stub</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="translate">
- <properties>
- <help>Configure NSSA-ABR (default: candidate)</help>
- <completionHelp>
- <list>always candidate never</list>
- </completionHelp>
- <valueHelp>
- <format>always</format>
- <description>NSSA-ABR to always translate</description>
- </valueHelp>
- <valueHelp>
- <format>candidate</format>
- <description>NSSA-ABR for translate election (default)</description>
- </valueHelp>
- <valueHelp>
- <format>never</format>
- <description>NSSA-ABR to never translate</description>
- </valueHelp>
- <constraint>
- <regex>^(always|candidate|never)$</regex>
- </constraint>
- </properties>
- <defaultValue>candidate</defaultValue>
- </leafNode>
- </children>
- </node>
- <node name="stub">
- <properties>
- <help>Stub OSPF area</help>
- </properties>
- <children>
- <leafNode name="default-cost">
- <properties>
- <help>Summary-default cost of nssa area</help>
- <valueHelp>
- <format>u32:0-16777215</format>
- <description>Summary default cost</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-16777215"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="no-summary">
- <properties>
- <help>Do not inject inter-area routes into stub</help>
- <valueless/>
- </properties>
- </leafNode>
- </children>
- </node>
- </children>
- </node>
- <leafNode name="authentication">
- <properties>
- <help>OSPF area authentication type</help>
- <completionHelp>
- <list>plaintext-password md5</list>
- </completionHelp>
- <valueHelp>
- <format>plaintext-password</format>
- <description>Use plain-text authentication</description>
- </valueHelp>
- <valueHelp>
- <format>md5</format>
- <description>Use md5 authentication</description>
- </valueHelp>
- <constraint>
- <regex>^(plaintext-password|md5)$</regex>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="network">
- <properties>
- <help>OSPF network [REQUIRED]</help>
- <valueHelp>
- <format>ipv4net</format>
- <description>OSPF network [REQUIRED]</description>
- </valueHelp>
- <constraint>
- <validator name="ipv4-prefix"/>
- </constraint>
- <multi/>
- </properties>
- </leafNode>
- <tagNode name="range">
- <properties>
- <help>Summarize routes matching prefix (border routers only)</help>
- <valueHelp>
- <format>ipv4net</format>
- <description>Area range prefix</description>
- </valueHelp>
- <constraint>
- <validator name="ipv4-prefix"/>
- </constraint>
- </properties>
- <children>
- <leafNode name="cost">
- <properties>
- <help>Metric for this range</help>
- <valueHelp>
- <format>u32:0-16777215</format>
- <description>Metric for this range</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-16777215"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="not-advertise">
- <properties>
- <help>Do not advertise this range</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="substitute">
- <properties>
- <help>Announce area range as another prefix</help>
- <valueHelp>
- <format>ipv4net</format>
- <description>Announce area range as another prefix</description>
- </valueHelp>
- <constraint>
- <validator name="ipv4-prefix"/>
- </constraint>
- </properties>
- </leafNode>
- </children>
- </tagNode>
- <leafNode name="shortcut">
- <properties>
- <help>Area shortcut mode</help>
- <completionHelp>
- <list>default disable enable</list>
- </completionHelp>
- <valueHelp>
- <format>default</format>
- <description>Set default</description>
- </valueHelp>
- <valueHelp>
- <format>disable</format>
- <description>Disable shortcutting mode</description>
- </valueHelp>
- <valueHelp>
- <format>enable</format>
- <description>Enable shortcutting mode</description>
- </valueHelp>
- <constraint>
- <regex>^(default|disable|enable)$</regex>
- </constraint>
- </properties>
- </leafNode>
- <tagNode name="virtual-link">
- <properties>
- <help>Virtual link</help>
- <valueHelp>
- <format>ipv4</format>
- <description>OSPF area in dotted decimal notation</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-4294967295"/>
- <validator name="ip-address"/>
- </constraint>
- </properties>
- <children>
- #include <include/ospf-authentication.xml.i>
- #include <include/ospf-intervals.xml.i>
- </children>
- </tagNode>
- </children>
- </tagNode>
- <node name="auto-cost">
- <properties>
- <help>Calculate OSPF interface cost according to bandwidth (default: 100)</help>
- </properties>
- <children>
- <leafNode name="reference-bandwidth">
- <properties>
- <help>Reference bandwidth method to assign OSPF cost</help>
- <valueHelp>
- <format>u32:1-4294967</format>
- <description>Reference bandwidth cost in Mbits/sec</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-4294967"/>
- </constraint>
- </properties>
- <defaultValue>100</defaultValue>
- </leafNode>
- </children>
- </node>
- <node name="default-information">
- <properties>
- <help>Control distribution of default information</help>
- </properties>
- <children>
- <node name="originate">
- <properties>
- <help>Distribute a default route</help>
- </properties>
- <children>
- <leafNode name="always">
- <properties>
- <help>Always advertise default route</help>
- <valueless/>
- </properties>
- </leafNode>
- #include <include/ospf-metric.xml.i>
- #include <include/ospf-metric-type.xml.i>
- #include <include/ospf-route-map.xml.i>
- </children>
- </node>
- </children>
- </node>
- <leafNode name="default-metric">
- <properties>
- <help>Metric of redistributed routes</help>
- <valueHelp>
- <format>u32:0-16777214</format>
- <description>Metric of redistributed routes</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-16777214"/>
- </constraint>
- </properties>
- </leafNode>
- <node name="distance">
- <properties>
- <help>Administrative distance</help>
- </properties>
- <children>
- <leafNode name="global">
- <properties>
- <help>OSPF administrative distance</help>
- <valueHelp>
- <format>u32:1-255</format>
- <description>Administrative distance</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-255"/>
- </constraint>
- </properties>
- </leafNode>
- <node name="ospf">
- <properties>
- <help>OSPF administrative distance</help>
- </properties>
- <children>
- <leafNode name="external">
- <properties>
- <help>Distance for external routes</help>
- <valueHelp>
- <format>u32:1-255</format>
- <description>Distance for external routes</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-255"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="inter-area">
- <properties>
- <help>Distance for inter-area routes</help>
- <valueHelp>
- <format>u32:1-255</format>
- <description>Distance for inter-area routes</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-255"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="intra-area">
- <properties>
- <help>Distance for intra-area routes</help>
- <valueHelp>
- <format>u32:1-255</format>
- <description>Distance for intra-area routes</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-255"/>
- </constraint>
- </properties>
- </leafNode>
- </children>
- </node>
- </children>
- </node>
- <tagNode name="interface">
- <properties>
- <help>Interface related configuration</help>
- <completionHelp>
- <script>${vyos_completion_dir}/list_interfaces.py</script>
- </completionHelp>
- <valueHelp>
- <format>txt</format>
- <description>Interface name</description>
- </valueHelp>
- <constraint>
- <validator name="interface-name"/>
- </constraint>
- </properties>
- <children>
- #include <include/ospf-authentication.xml.i>
- #include <include/ospf-intervals.xml.i>
- #include <include/ospf-interface-common.xml.i>
- <leafNode name="bandwidth">
- <properties>
- <help>Bandwidth of interface (Megabit/sec)</help>
- <valueHelp>
- <format>u32:1-100000</format>
- <description>Bandwidth in Megabit/sec (for calculating OSPF cost)</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-100000"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="hello-multiplier">
- <properties>
- <help>Hello multiplier factor</help>
- <valueHelp>
- <format>u32:1-10</format>
- <description>Number of Hellos to send each second</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-10"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="network">
- <properties>
- <help>Network type</help>
- <completionHelp>
- <list>broadcast non-broadcast point-to-multipoint point-to-point</list>
- </completionHelp>
- <valueHelp>
- <format>broadcast</format>
- <description>Broadcast network type</description>
- </valueHelp>
- <valueHelp>
- <format>non-broadcast</format>
- <description>Non-broadcast network type</description>
- </valueHelp>
- <valueHelp>
- <format>point-to-multipoint</format>
- <description>Point-to-multipoint network type</description>
- </valueHelp>
- <valueHelp>
- <format>point-to-point</format>
- <description>Point-to-point network type</description>
- </valueHelp>
- <constraint>
- <regex>^(broadcast|non-broadcast|point-to-multipoint|point-to-point)$</regex>
- </constraint>
- <constraintErrorMessage>Must be broadcast, non-broadcast, point-to-multipoint or point-to-point</constraintErrorMessage>
- </properties>
- </leafNode>
- </children>
- </tagNode>
- <node name="log-adjacency-changes">
- <properties>
- <help>Log changes in adjacency state</help>
- </properties>
- <children>
- <leafNode name="detail">
- <properties>
- <help>Log all state changes</help>
- <valueless/>
- </properties>
- </leafNode>
- </children>
- </node>
- <node name="max-metric">
- <properties>
- <help>OSPF maximum and infinite-distance metric</help>
- </properties>
- <children>
- <node name="router-lsa">
- <properties>
- <help>Advertise own Router-LSA with infinite distance (stub router)</help>
- </properties>
- <children>
- <leafNode name="administrative">
- <properties>
- <help>Administratively apply, for an indefinite period</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="on-shutdown">
- <properties>
- <help>Advertise stub-router prior to full shutdown of OSPF</help>
- <valueHelp>
- <format>u32:5-100</format>
- <description>Time (seconds) to advertise self as stub-router</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 5-100"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="on-startup">
- <properties>
- <help>Automatically advertise stub Router-LSA on startup of OSPF</help>
- <valueHelp>
- <format>u32:5-86400</format>
- <description>Time (seconds) to advertise self as stub-router</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 5-86400"/>
- </constraint>
- </properties>
- </leafNode>
- </children>
- </node>
- </children>
- </node>
- <node name="mpls-te">
- <properties>
- <help>MultiProtocol Label Switching-Traffic Engineering (MPLS-TE) parameters</help>
- </properties>
- <children>
- <leafNode name="enable">
- <properties>
- <help>Enable MPLS-TE functionality</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="router-address">
- <properties>
- <help>Stable IP address of the advertising router</help>
- <valueHelp>
- <format>ipv4</format>
- <description>Stable IP address of the advertising router</description>
- </valueHelp>
- <constraint>
- <validator name="ipv4-address"/>
- </constraint>
- </properties>
- <defaultValue>0.0.0.0</defaultValue>
- </leafNode>
- </children>
- </node>
- <tagNode name="neighbor">
- <properties>
- <help>Specify neighbor router</help>
- <valueHelp>
- <format>ipv4</format>
- <description>Neighbor IP address</description>
- </valueHelp>
- <constraint>
- <validator name="ipv4-address"/>
- </constraint>
- </properties>
- <children>
- <leafNode name="poll-interval">
- <properties>
- <help>Dead neighbor polling interval (default: 60)</help>
- <valueHelp>
- <format>u32:1-65535</format>
- <description>Seconds between dead neighbor polling interval</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-65535"/>
- </constraint>
- </properties>
- <defaultValue>60</defaultValue>
- </leafNode>
- <leafNode name="priority">
- <properties>
- <help>Neighbor priority in seconds (default: 0)</help>
- <valueHelp>
- <format>u32:0-255</format>
- <description>Neighbor priority</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-255"/>
- </constraint>
- </properties>
- <defaultValue>0</defaultValue>
- </leafNode>
- </children>
- </tagNode>
- <node name="parameters">
- <properties>
- <help>OSPF specific parameters</help>
- </properties>
- <children>
- <leafNode name="abr-type">
- <properties>
- <help>OSPF ABR type (default: cisco)</help>
- <completionHelp>
- <list>cisco ibm shortcut standard</list>
- </completionHelp>
- <valueHelp>
- <format>cisco</format>
- <description>Cisco ABR type (default)</description>
- </valueHelp>
- <valueHelp>
- <format>ibm</format>
- <description>Ibm ABR type</description>
- </valueHelp>
- <valueHelp>
- <format>shortcut</format>
- <description>Shortcut ABR type</description>
- </valueHelp>
- <valueHelp>
- <format>standard</format>
- <description>Standard ABR type</description>
- </valueHelp>
- <constraint>
- <regex>^(cisco|ibm|shortcut|standard)$</regex>
- </constraint>
- </properties>
- <defaultValue>cisco</defaultValue>
- </leafNode>
- <leafNode name="opaque-lsa">
- <properties>
- <help>Enable the Opaque-LSA capability (rfc2370)</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="rfc1583-compatibility">
- <properties>
- <help>Enable rfc1583 criteria for handling AS external routes</help>
- <valueless/>
- </properties>
- </leafNode>
- <leafNode name="router-id">
- <properties>
- <help>Override the default router identifier</help>
- <valueHelp>
- <format>ipv4</format>
- <description>Override the default router identifier</description>
- </valueHelp>
- <constraint>
- <validator name="ipv4-address"/>
- </constraint>
- </properties>
- </leafNode>
- </children>
- </node>
- #include <include/routing-passive-interface-xml.i>
- <leafNode name="passive-interface-exclude">
- <properties>
- <help>Interface to exclude when using 'passive-interface default'</help>
- <completionHelp>
- <script>${vyos_completion_dir}/list_interfaces.py</script>
- </completionHelp>
- <valueHelp>
- <format>txt</format>
- <description>Interface to exclude when suppressing routing updates</description>
- </valueHelp>
- <valueHelp>
- <format>vlinkN</format>
- <description>Virtual-link interface to exclude when suppressing routing updates</description>
- </valueHelp>
- <constraint>
- <validator name="interface-name"/>
- <regex>^(vlink[0-9]+)$</regex>
- </constraint>
- <multi/>
- </properties>
- </leafNode>
- <node name="redistribute">
- <properties>
- <help>Redistribute information from another routing protocol</help>
- </properties>
- <children>
- <node name="bgp">
- <properties>
- <help>Redistribute BGP routes</help>
- </properties>
- <children>
- #include <include/ospf-metric.xml.i>
- #include <include/ospf-metric-type.xml.i>
- #include <include/ospf-route-map.xml.i>
- </children>
- </node>
- <node name="connected">
- <properties>
- <help>Redistribute connected routes</help>
- </properties>
- <children>
- #include <include/ospf-metric.xml.i>
- #include <include/ospf-metric-type.xml.i>
- #include <include/ospf-route-map.xml.i>
- </children>
- </node>
- <node name="isis">
- <properties>
- <help>Redistribute IS-IS routes</help>
- </properties>
- <children>
- #include <include/ospf-metric.xml.i>
- #include <include/ospf-metric-type.xml.i>
- #include <include/ospf-route-map.xml.i>
- </children>
- </node>
- <node name="kernel">
- <properties>
- <help>Redistribute kernel routes</help>
- </properties>
- <children>
- #include <include/ospf-metric.xml.i>
- #include <include/ospf-metric-type.xml.i>
- #include <include/ospf-route-map.xml.i>
- </children>
- </node>
- <node name="rip">
- <properties>
- <help>Redistribute rip routes</help>
- </properties>
- <children>
- #include <include/ospf-metric.xml.i>
- #include <include/ospf-metric-type.xml.i>
- #include <include/ospf-route-map.xml.i>
- </children>
- </node>
- <node name="static">
- <properties>
- <help>Redistribute static routes</help>
- </properties>
- <children>
- #include <include/ospf-metric.xml.i>
- #include <include/ospf-metric-type.xml.i>
- #include <include/ospf-route-map.xml.i>
- </children>
- </node>
- </children>
- </node>
- <node name="refresh">
- <properties>
- <help>Adjust refresh parameters</help>
- </properties>
- <children>
- <leafNode name="timers">
- <properties>
- <help>Refresh timer</help>
- <valueHelp>
- <format>u32:10-1800</format>
- <description>Timer value in seconds</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 10-1800"/>
- </constraint>
- </properties>
- </leafNode>
- </children>
- </node>
- #include <include/ospf-route-map.xml.i>
- <node name="timers">
- <properties>
- <help>Adjust routing timers</help>
- </properties>
- <children>
- <node name="throttle">
- <properties>
- <help>Throttling adaptive timers</help>
- </properties>
- <children>
- <node name="spf">
- <properties>
- <help>OSPF SPF timers</help>
- </properties>
- <children>
- <leafNode name="delay">
- <properties>
- <help>Delay from first change received till SPF calculation (default: 200)</help>
- <valueHelp>
- <format>u32:0-600000</format>
- <description>Delay in milliseconds</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-600000"/>
- </constraint>
- </properties>
- <defaultValue>200</defaultValue>
- </leafNode>
- <leafNode name="initial-holdtime">
- <properties>
- <help>Initial hold time between consecutive SPF calculations (default: 1000)</help>
- <valueHelp>
- <format>u32:0-600000</format>
- <description>Initial hold time in milliseconds</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-600000"/>
- </constraint>
- </properties>
- <defaultValue>1000</defaultValue>
- </leafNode>
- <leafNode name="max-holdtime">
- <properties>
- <help>Maximum hold time (default: 10000)</help>
- <valueHelp>
- <format>u32:0-600000</format>
- <description>Max hold time in milliseconds</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 0-600000"/>
- </constraint>
- </properties>
- <defaultValue>10000</defaultValue>
- </leafNode>
- </children>
- </node>
- </children>
- </node>
- </children>
- </node>
+ #include <include/ospf/ospf-common-config.xml.i>
</children>
</node>
</children>
diff --git a/interface-definitions/protocols-ospfv3.xml.in b/interface-definitions/protocols-ospfv3.xml.in
index 2559e2b03..f4f403e93 100644
--- a/interface-definitions/protocols-ospfv3.xml.in
+++ b/interface-definitions/protocols-ospfv3.xml.in
@@ -90,59 +90,13 @@
<help>Administrative distance</help>
</properties>
<children>
- <leafNode name="global">
- <properties>
- <help>OSPFv3 administrative distance</help>
- <valueHelp>
- <format>u32:1-255</format>
- <description>Administrative distance</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-255"/>
- </constraint>
- </properties>
- </leafNode>
+ #include <include/ospf/ospf-distance-global.xml.i>
<node name="ospfv3">
<properties>
<help>OSPFv3 administrative distance</help>
</properties>
<children>
- <leafNode name="external">
- <properties>
- <help>Distance for external routes</help>
- <valueHelp>
- <format>u32:1-255</format>
- <description>Distance for external routes</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-255"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="inter-area">
- <properties>
- <help>Distance for inter-area routes</help>
- <valueHelp>
- <format>u32:1-255</format>
- <description>Distance for inter-area routes</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-255"/>
- </constraint>
- </properties>
- </leafNode>
- <leafNode name="intra-area">
- <properties>
- <help>Distance for intra-area routes</help>
- <valueHelp>
- <format>u32:1-255</format>
- <description>Distance for intra-area routes</description>
- </valueHelp>
- <constraint>
- <validator name="numeric" argument="--range 1-255"/>
- </constraint>
- </properties>
- </leafNode>
+ #include <include/ospf/ospf-distance-per-protocol.xml.i>
</children>
</node>
</children>
@@ -162,8 +116,8 @@
</constraint>
</properties>
<children>
- #include <include/ospf-intervals.xml.i>
- #include <include/ospf-interface-common.xml.i>
+ #include <include/ospf/ospf-intervals.xml.i>
+ #include <include/ospf/ospf-interface-common.xml.i>
<leafNode name="ifmtu">
<properties>
<help>Interface MTU</help>
@@ -209,12 +163,7 @@
<constraintErrorMessage>Must be broadcast or point-to-point</constraintErrorMessage>
</properties>
</leafNode>
- <leafNode name="passive">
- <properties>
- <help>Disable forming of adjacency</help>
- <valueless/>
- </properties>
- </leafNode>
+ #include <include/isis/passive.xml.i>
</children>
</tagNode>
<node name="parameters">
@@ -222,18 +171,7 @@
<help>OSPFv3 specific parameters</help>
</properties>
<children>
- <leafNode name="router-id">
- <properties>
- <help>Override the default router identifier</help>
- <valueHelp>
- <format>ipv4</format>
- <description>Override the default router identifier</description>
- </valueHelp>
- <constraint>
- <validator name="ipv4-address"/>
- </constraint>
- </properties>
- </leafNode>
+ #include <include/ospf/ospf-router-id.xml.i>
</children>
</node>
<node name="redistribute">
@@ -246,7 +184,7 @@
<help>Redistribute BGP routes</help>
</properties>
<children>
- #include <include/ospf-route-map.xml.i>
+ #include <include/route-map.xml.i>
</children>
</node>
<node name="connected">
@@ -254,7 +192,7 @@
<help>Redistribute connected routes</help>
</properties>
<children>
- #include <include/ospf-route-map.xml.i>
+ #include <include/route-map.xml.i>
</children>
</node>
<node name="kernel">
@@ -262,7 +200,7 @@
<help>Redistribute kernel routes</help>
</properties>
<children>
- #include <include/ospf-route-map.xml.i>
+ #include <include/route-map.xml.i>
</children>
</node>
<node name="ripng">
@@ -270,7 +208,7 @@
<help>Redistribute RIPNG routes</help>
</properties>
<children>
- #include <include/ospf-route-map.xml.i>
+ #include <include/route-map.xml.i>
</children>
</node>
<node name="static">
@@ -278,12 +216,12 @@
<help>Redistribute static routes</help>
</properties>
<children>
- #include <include/ospf-route-map.xml.i>
+ #include <include/route-map.xml.i>
</children>
</node>
</children>
</node>
- #include <include/ospf-route-map.xml.i>
+ #include <include/route-map.xml.i>
</children>
</node>
</children>
diff --git a/interface-definitions/protocols-rip.xml.in b/interface-definitions/protocols-rip.xml.in
index 1ae3bd8f7..fd1a84bb8 100644
--- a/interface-definitions/protocols-rip.xml.in
+++ b/interface-definitions/protocols-rip.xml.in
@@ -5,6 +5,7 @@
<node name="rip" owner="${vyos_conf_scripts_dir}/protocols_rip.py">
<properties>
<help>Routing Information Protocol (RIP) parameters</help>
+ <priority>650</priority>
</properties>
<children>
<leafNode name="default-distance">
@@ -19,14 +20,14 @@
</constraint>
</properties>
</leafNode>
- #include <include/rip-default-information.xml.i>
- #include <include/rip-default-metric.xml.i>
+ #include <include/rip/rip-default-information.xml.i>
+ #include <include/rip/rip-default-metric.xml.i>
<node name="distribute-list">
<properties>
<help>Filter networks in routing updates</help>
</properties>
<children>
- #include <include/rip-access-list.xml.i>
+ #include <include/rip/rip-access-list.xml.i>
<tagNode name="interface">
<properties>
<help>Apply filtering to an interface</help>
@@ -42,14 +43,14 @@
</constraint>
</properties>
<children>
- #include <include/rip-access-list.xml.i>
- #include <include/rip-prefix-list.xml.i>
+ #include <include/rip/rip-access-list.xml.i>
+ #include <include/rip/rip-prefix-list.xml.i>
</children>
</tagNode>
- #include <include/rip-prefix-list.xml.i>
+ #include <include/rip/rip-prefix-list.xml.i>
</children>
</node>
- #include <include/rip-interface.xml.i>
+ #include <include/rip/rip-interface.xml.i>
<tagNode name="interface">
<children>
<node name="authentication">
@@ -151,7 +152,7 @@
</completionHelp>
</properties>
</leafNode>
- #include <include/static-route-distance.xml.i>
+ #include <include/static/static-route-distance.xml.i>
</children>
</tagNode>
#include <include/routing-passive-interface-xml.i>
@@ -165,7 +166,7 @@
<help>Redistribute BGP routes</help>
</properties>
<children>
- #include <include/rip-redistribute.xml.i>
+ #include <include/rip/rip-redistribute.xml.i>
</children>
</node>
<node name="connected">
@@ -173,7 +174,7 @@
<help>Redistribute connected routes</help>
</properties>
<children>
- #include <include/rip-redistribute.xml.i>
+ #include <include/rip/rip-redistribute.xml.i>
</children>
</node>
<node name="isis">
@@ -181,7 +182,7 @@
<help>Redistribute IS-IS routes</help>
</properties>
<children>
- #include <include/rip-redistribute.xml.i>
+ #include <include/rip/rip-redistribute.xml.i>
</children>
</node>
<node name="kernel">
@@ -189,7 +190,7 @@
<help>Redistribute kernel routes</help>
</properties>
<children>
- #include <include/rip-redistribute.xml.i>
+ #include <include/rip/rip-redistribute.xml.i>
</children>
</node>
<node name="ospf">
@@ -197,7 +198,7 @@
<help>Redistribute OSPF routes</help>
</properties>
<children>
- #include <include/rip-redistribute.xml.i>
+ #include <include/rip/rip-redistribute.xml.i>
</children>
</node>
<node name="static">
@@ -205,7 +206,7 @@
<help>Redistribute static routes</help>
</properties>
<children>
- #include <include/rip-redistribute.xml.i>
+ #include <include/rip/rip-redistribute.xml.i>
</children>
</node>
</children>
@@ -223,7 +224,7 @@
<multi/>
</properties>
</leafNode>
- #include <include/rip-timers.xml.i>
+ #include <include/rip/rip-timers.xml.i>
</children>
</node>
</children>
diff --git a/interface-definitions/protocols-ripng.xml.in b/interface-definitions/protocols-ripng.xml.in
index e456c3f3b..fe7411e65 100644
--- a/interface-definitions/protocols-ripng.xml.in
+++ b/interface-definitions/protocols-ripng.xml.in
@@ -5,6 +5,7 @@
<node name="ripng" owner="${vyos_conf_scripts_dir}/protocols_ripng.py">
<properties>
<help>Routing Information Protocol (RIPng) parameters</help>
+ <priority>660</priority>
</properties>
<children>
<leafNode name="aggregate-address">
@@ -20,14 +21,14 @@
<multi/>
</properties>
</leafNode>
- #include <include/rip-default-information.xml.i>
- #include <include/rip-default-metric.xml.i>
+ #include <include/rip/rip-default-information.xml.i>
+ #include <include/rip/rip-default-metric.xml.i>
<node name="distribute-list">
<properties>
<help>Filter networks in routing updates</help>
</properties>
<children>
- #include <include/rip-access-list6.xml.i>
+ #include <include/rip/rip-access-list6.xml.i>
<tagNode name="interface">
<properties>
<help>Apply filtering to an interface</help>
@@ -43,14 +44,14 @@
</constraint>
</properties>
<children>
- #include <include/rip-access-list6.xml.i>
- #include <include/rip-prefix-list6.xml.i>
+ #include <include/rip/rip-access-list6.xml.i>
+ #include <include/rip/rip-prefix-list6.xml.i>
</children>
</tagNode>
- #include <include/rip-prefix-list6.xml.i>
+ #include <include/rip/rip-prefix-list6.xml.i>
</children>
</node>
- #include <include/rip-interface.xml.i>
+ #include <include/rip/rip-interface.xml.i>
<leafNode name="network">
<properties>
<help>RIPng network</help>
@@ -87,7 +88,7 @@
<help>Redistribute BGP routes</help>
</properties>
<children>
- #include <include/rip-redistribute.xml.i>
+ #include <include/rip/rip-redistribute.xml.i>
</children>
</node>
<node name="connected">
@@ -95,7 +96,7 @@
<help>Redistribute connected routes</help>
</properties>
<children>
- #include <include/rip-redistribute.xml.i>
+ #include <include/rip/rip-redistribute.xml.i>
</children>
</node>
<node name="kernel">
@@ -103,7 +104,7 @@
<help>Redistribute kernel routes</help>
</properties>
<children>
- #include <include/rip-redistribute.xml.i>
+ #include <include/rip/rip-redistribute.xml.i>
</children>
</node>
<node name="ospfv3">
@@ -111,7 +112,7 @@
<help>Redistribute OSPFv3 routes</help>
</properties>
<children>
- #include <include/rip-redistribute.xml.i>
+ #include <include/rip/rip-redistribute.xml.i>
</children>
</node>
<node name="static">
@@ -119,7 +120,7 @@
<help>Redistribute static routes</help>
</properties>
<children>
- #include <include/rip-redistribute.xml.i>
+ #include <include/rip/rip-redistribute.xml.i>
</children>
</node>
</children>
@@ -137,8 +138,8 @@
<multi/>
</properties>
</leafNode>
- #include <include/ospf-route-map.xml.i>
- #include <include/rip-timers.xml.i>
+ #include <include/route-map.xml.i>
+ #include <include/rip/rip-timers.xml.i>
</children>
</node>
</children>
diff --git a/interface-definitions/protocols-static.xml.in b/interface-definitions/protocols-static.xml.in
index 59a7927a5..ab60649a0 100644
--- a/interface-definitions/protocols-static.xml.in
+++ b/interface-definitions/protocols-static.xml.in
@@ -5,11 +5,12 @@
<node name="static" owner="${vyos_conf_scripts_dir}/protocols_static.py">
<properties>
<help>Static route parameters</help>
+ <priority>480</priority>
</properties>
<children>
- #include <include/static-route-map.xml.i>
- #include <include/static-route.xml.i>
- #include <include/static-route6.xml.i>
+ #include <include/static/static-route-map.xml.i>
+ #include <include/static/static-route.xml.i>
+ #include <include/static/static-route6.xml.i>
<tagNode name="table">
<properties>
<help>Policy route table number</help>
@@ -22,8 +23,8 @@
</constraint>
</properties>
<children>
- #include <include/static-route.xml.i>
- #include <include/static-route6.xml.i>
+ #include <include/static/static-route.xml.i>
+ #include <include/static/static-route6.xml.i>
</children>
</tagNode>
</children>
diff --git a/interface-definitions/protocols-vrf.xml.in b/interface-definitions/protocols-vrf.xml.in
deleted file mode 100644
index 77297938b..000000000
--- a/interface-definitions/protocols-vrf.xml.in
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<interfaceDefinition>
- <node name="protocols">
- <children>
- <tagNode name="vrf" owner="${vyos_conf_scripts_dir}/protocols_vrf.py">
- <properties>
- <help>Name of VRF to add route for</help>
- <completionHelp>
- <path>vrf name</path>
- </completionHelp>
- <valueHelp>
- <format>txt</format>
- <description>VRF instance name</description>
- </valueHelp>
- <constraint>
- <validator name="vrf-name"/>
- </constraint>
- <constraintErrorMessage>VRF instance name must be 15 characters or less and can not\nbe named as regular network interfaces.\n</constraintErrorMessage>
- </properties>
- <children>
- <node name="static">
- <properties>
- <help>Static route parameters</help>
- </properties>
- <children>
- #include <include/static-route.xml.i>
- #include <include/static-route6.xml.i>
- </children>
- </node>
- #include <include/vni.xml.i>
- </children>
- </tagNode>
- </children>
- </node>
-</interfaceDefinition>
diff --git a/interface-definitions/service_console-server.xml.in b/interface-definitions/service_console-server.xml.in
index 293ee1ba5..78eb2d0ba 100644
--- a/interface-definitions/service_console-server.xml.in
+++ b/interface-definitions/service_console-server.xml.in
@@ -27,7 +27,7 @@
</constraint>
</properties>
<children>
- #include <include/interface-description.xml.i>
+ #include <include/interface/interface-description.xml.i>
<leafNode name="speed">
<properties>
<help>Serial port baud rate</help>
diff --git a/interface-definitions/service_ipoe-server.xml.in b/interface-definitions/service_ipoe-server.xml.in
index c54de58f5..d0a05aea6 100644
--- a/interface-definitions/service_ipoe-server.xml.in
+++ b/interface-definitions/service_ipoe-server.xml.in
@@ -111,8 +111,8 @@
</leafNode>
</children>
</tagNode>
- #include <include/accel-name-server.xml.i>
- #include <include/accel-client-ipv6-pool.xml.i>
+ #include <include/accel-ppp/name-server.xml.i>
+ #include <include/accel-ppp/client-ipv6-pool.xml.i>
<node name="authentication">
<properties>
<help>Client authentication methods</help>
@@ -198,7 +198,7 @@
</children>
</tagNode>
#include <include/radius-server-ipv4.xml.i>
- #include <include/accel-radius-additions.xml.i>
+ #include <include/accel-ppp/radius-additions.xml.i>
</children>
</node>
</children>
diff --git a/interface-definitions/service_pppoe-server.xml.in b/interface-definitions/service_pppoe-server.xml.in
index 5c0a66527..1d3e8ba29 100644
--- a/interface-definitions/service_pppoe-server.xml.in
+++ b/interface-definitions/service_pppoe-server.xml.in
@@ -23,14 +23,14 @@
<help>Authentication for remote access PPPoE Server</help>
</properties>
<children>
- #include <include/accel-auth-local-users.xml.i>
- #include <include/accel-auth-mode.xml.i>
- #include <include/accel-auth-protocols.xml.i>
+ #include <include/accel-ppp/auth-local-users.xml.i>
+ #include <include/accel-ppp/auth-mode.xml.i>
+ #include <include/accel-ppp/auth-protocols.xml.i>
#include <include/radius-server-ipv4.xml.i>
- #include <include/accel-radius-additions.xml.i>
+ #include <include/accel-ppp/radius-additions.xml.i>
<node name="radius">
<children>
- #include <include/accel-radius-additions-rate-limit.xml.i>
+ #include <include/accel-ppp/radius-additions-rate-limit.xml.i>
<leafNode name="called-sid-format">
<properties>
<help>Format of Called-Station-Id attribute</help>
@@ -60,12 +60,12 @@
<help>Pool of client IP addresses (must be within a /24)</help>
</properties>
<children>
- #include <include/accel-client-ip-pool-start-stop.xml.i>
- #include <include/accel-client-ip-pool-subnet.xml.i>
+ #include <include/accel-ppp/client-ip-pool-start-stop.xml.i>
+ #include <include/accel-ppp/client-ip-pool-subnet.xml.i>
</children>
</node>
- #include <include/accel-client-ipv6-pool.xml.i>
- #include <include/accel-name-server.xml.i>
+ #include <include/accel-ppp/client-ipv6-pool.xml.i>
+ #include <include/accel-ppp/name-server.xml.i>
<tagNode name="interface">
<properties>
<help>interface(s) to listen on</help>
@@ -95,8 +95,8 @@
</leafNode>
</children>
</tagNode>
- #include <include/accel-gateway-address.xml.i>
- #include <include/accel-mtu-128-16384.xml.i>
+ #include <include/accel-ppp/gateway-address.xml.i>
+ #include <include/accel-ppp/mtu-128-16384.xml.i>
<node name="limits">
<properties>
<help>Limits the connection rate from a single source</help>
@@ -133,7 +133,7 @@
<multi/>
</properties>
</leafNode>
- #include <include/accel-wins-server.xml.i>
+ #include <include/accel-ppp/wins-server.xml.i>
<node name="ppp-options">
<properties>
<help>Advanced protocol options</help>
@@ -161,9 +161,9 @@
<valueless />
</properties>
</leafNode>
- #include <include/accel-ppp-mppe.xml.i>
- #include <include/accel-lcp-echo-interval-failure.xml.i>
- #include <include/accel-lcp-echo-timeout.xml.i>
+ #include <include/accel-ppp/ppp-mppe.xml.i>
+ #include <include/accel-ppp/lcp-echo-interval-failure.xml.i>
+ #include <include/accel-ppp/lcp-echo-timeout.xml.i>
<leafNode name="ipv4">
<properties>
<help>IPv4 (IPCP) negotiation algorithm</help>
diff --git a/interface-definitions/snmp.xml.in b/interface-definitions/snmp.xml.in
index 3a993ec9c..f57103eac 100644
--- a/interface-definitions/snmp.xml.in
+++ b/interface-definitions/snmp.xml.in
@@ -626,7 +626,7 @@
</tagNode>
</children>
</node>
- #include <include/interface-vrf.xml.i>
+ #include <include/interface/interface-vrf.xml.i>
</children>
</node>
</children>
diff --git a/interface-definitions/ssh.xml.in b/interface-definitions/ssh.xml.in
index a2ce3c1c9..c2d514b09 100644
--- a/interface-definitions/ssh.xml.in
+++ b/interface-definitions/ssh.xml.in
@@ -182,7 +182,7 @@
</constraint>
</properties>
</leafNode>
- #include <include/interface-vrf.xml.i>
+ #include <include/interface/interface-vrf.xml.i>
</children>
</node>
</children>
diff --git a/interface-definitions/system-login.xml.in b/interface-definitions/system-login.xml.in
index 919974eeb..86db3f368 100644
--- a/interface-definitions/system-login.xml.in
+++ b/interface-definitions/system-login.xml.in
@@ -145,7 +145,7 @@
</leafNode>
</children>
</tagNode>
- #include <include/interface-vrf.xml.i>
+ #include <include/interface/interface-vrf.xml.i>
</children>
</node>
</children>
diff --git a/interface-definitions/vpn_l2tp.xml.in b/interface-definitions/vpn_l2tp.xml.in
index 3a6c8a992..2d8a8503d 100644
--- a/interface-definitions/vpn_l2tp.xml.in
+++ b/interface-definitions/vpn_l2tp.xml.in
@@ -12,7 +12,7 @@
<help>Remote access L2TP VPN</help>
</properties>
<children>
- #include <include/accel-mtu-128-16384.xml.i>
+ #include <include/accel-ppp/mtu-128-16384.xml.i>
<leafNode name="outside-address">
<properties>
<help>External IP address to which VPN clients will connect</help>
@@ -21,8 +21,8 @@
</constraint>
</properties>
</leafNode>
- #include <include/accel-gateway-address.xml.i>
- #include <include/accel-name-server.xml.i>
+ #include <include/accel-ppp/gateway-address.xml.i>
+ #include <include/accel-ppp/name-server.xml.i>
<node name="lns">
<properties>
<help>L2TP Network Server (LNS)</help>
@@ -143,17 +143,17 @@
</leafNode>
</children>
</node>
- #include <include/accel-wins-server.xml.i>
+ #include <include/accel-ppp/wins-server.xml.i>
<node name="client-ip-pool">
<properties>
<help>Pool of client IP addresses (must be within a /24)</help>
</properties>
<children>
- #include <include/accel-client-ip-pool-start-stop.xml.i>
- #include <include/accel-client-ip-pool-subnet.xml.i>
+ #include <include/accel-ppp/client-ip-pool-start-stop.xml.i>
+ #include <include/accel-ppp/client-ip-pool-subnet.xml.i>
</children>
</node>
- #include <include/accel-client-ipv6-pool.xml.i>
+ #include <include/accel-ppp/client-ipv6-pool.xml.i>
<leafNode name="description">
<properties>
<help>Description for L2TP remote-access settings</help>
@@ -209,15 +209,15 @@
<multi />
</properties>
</leafNode>
- #include <include/accel-ppp-mppe.xml.i>
- #include <include/accel-auth-mode.xml.i>
- #include <include/accel-auth-local-users.xml.i>
+ #include <include/accel-ppp/ppp-mppe.xml.i>
+ #include <include/accel-ppp/auth-mode.xml.i>
+ #include <include/accel-ppp/auth-local-users.xml.i>
#include <include/radius-server-ipv4.xml.i>
<node name="radius">
<children>
<tagNode name="server">
<children>
- #include <include/accel-radius-additions-disable-accounting.xml.i>
+ #include <include/accel-ppp/radius-additions-disable-accounting.xml.i>
<leafNode name="fail-time">
<properties>
<help>Mark server unavailable for &lt;n&gt; seconds on failure</help>
@@ -307,7 +307,7 @@
<help>Advanced protocol options</help>
</properties>
<children>
- #include <include/accel-lcp-echo-interval-failure.xml.i>
+ #include <include/accel-ppp/lcp-echo-interval-failure.xml.i>
</children>
</node>
</children>
diff --git a/interface-definitions/vpn_openconnect.xml.in b/interface-definitions/vpn_openconnect.xml.in
index 054e027fc..f64aa7f23 100644
--- a/interface-definitions/vpn_openconnect.xml.in
+++ b/interface-definitions/vpn_openconnect.xml.in
@@ -190,7 +190,7 @@
</leafNode>
</children>
</node>
- #include <include/accel-name-server.xml.i>
+ #include <include/accel-ppp/name-server.xml.i>
</children>
</node>
</children>
diff --git a/interface-definitions/vpn_pptp.xml.in b/interface-definitions/vpn_pptp.xml.in
index 72eda8752..7cf584a18 100644
--- a/interface-definitions/vpn_pptp.xml.in
+++ b/interface-definitions/vpn_pptp.xml.in
@@ -12,7 +12,7 @@
<help>Remote access PPTP VPN</help>
</properties>
<children>
- #include <include/accel-mtu-128-16384.xml.i>
+ #include <include/accel-ppp/mtu-128-16384.xml.i>
<leafNode name="outside-address">
<properties>
<help>External IP address to which VPN clients will connect</help>
@@ -34,16 +34,16 @@
<multi/>
</properties>
</leafNode>
- #include <include/accel-wins-server.xml.i>
+ #include <include/accel-ppp/wins-server.xml.i>
<node name="client-ip-pool">
<properties>
<help>Pool of client IP addresses (must be within a /24)</help>
</properties>
<children>
- #include <include/accel-client-ip-pool-start-stop.xml.i>
+ #include <include/accel-ppp/client-ip-pool-start-stop.xml.i>
</children>
</node>
- #include <include/accel-gateway-address.xml.i>
+ #include <include/accel-ppp/gateway-address.xml.i>
<node name="authentication">
<properties>
<help>Authentication for remote access PPTP VPN</help>
@@ -93,7 +93,7 @@
</completionHelp>
</properties>
</leafNode>
- #include <include/accel-auth-mode.xml.i>
+ #include <include/accel-ppp/auth-mode.xml.i>
<node name="local-users">
<properties>
<help>Local user authentication for remote access PPTP VPN</help>
@@ -120,7 +120,7 @@
</children>
</node>
#include <include/radius-server-ipv4.xml.i>
- #include <include/accel-radius-additions.xml.i>
+ #include <include/accel-ppp/radius-additions.xml.i>
</children>
</node>
</children>
diff --git a/interface-definitions/vpn_sstp.xml.in b/interface-definitions/vpn_sstp.xml.in
index ebcb77db2..e4ade844d 100644
--- a/interface-definitions/vpn_sstp.xml.in
+++ b/interface-definitions/vpn_sstp.xml.in
@@ -13,38 +13,38 @@
<help>Authentication for remote access SSTP Server</help>
</properties>
<children>
- #include <include/accel-auth-local-users.xml.i>
- #include <include/accel-auth-mode.xml.i>
- #include <include/accel-auth-protocols.xml.i>
+ #include <include/accel-ppp/auth-local-users.xml.i>
+ #include <include/accel-ppp/auth-mode.xml.i>
+ #include <include/accel-ppp/auth-protocols.xml.i>
#include <include/radius-server-ipv4.xml.i>
- #include <include/accel-radius-additions.xml.i>
+ #include <include/accel-ppp/radius-additions.xml.i>
<node name="radius">
<children>
- #include <include/accel-radius-additions-rate-limit.xml.i>
+ #include <include/accel-ppp/radius-additions-rate-limit.xml.i>
</children>
</node>
</children>
</node>
- #include <include/interface-mtu-68-1500.xml.i>
- #include <include/accel-gateway-address.xml.i>
- #include <include/accel-name-server.xml.i>
+ #include <include/interface/interface-mtu-68-1500.xml.i>
+ #include <include/accel-ppp/gateway-address.xml.i>
+ #include <include/accel-ppp/name-server.xml.i>
<node name="client-ip-pool">
<properties>
<help>Client IP pools and gateway setting</help>
</properties>
<children>
- #include <include/accel-client-ip-pool-subnet.xml.i>
+ #include <include/accel-ppp/client-ip-pool-subnet.xml.i>
</children>
</node>
- #include <include/accel-client-ipv6-pool.xml.i>
+ #include <include/accel-ppp/client-ipv6-pool.xml.i>
<node name="ppp-options">
<properties>
<help>PPP (Point-to-Point Protocol) settings</help>
</properties>
<children>
- #include <include/accel-ppp-mppe.xml.i>
- #include <include/accel-lcp-echo-interval-failure.xml.i>
- #include <include/accel-lcp-echo-timeout.xml.i>
+ #include <include/accel-ppp/ppp-mppe.xml.i>
+ #include <include/accel-ppp/lcp-echo-interval-failure.xml.i>
+ #include <include/accel-ppp/lcp-echo-timeout.xml.i>
</children>
</node>
<node name="ssl">
diff --git a/interface-definitions/vrf.xml.in b/interface-definitions/vrf.xml.in
index eca9e75a7..8a56b1bc0 100644
--- a/interface-definitions/vrf.xml.in
+++ b/interface-definitions/vrf.xml.in
@@ -3,8 +3,8 @@
<node name="vrf" owner="${vyos_conf_scripts_dir}/vrf.py">
<properties>
<help>Virtual Routing and Forwarding</help>
- <!-- must be before any interface creation -->
- <priority>10</priority>
+ <!-- must be before any interface, check /opt/vyatta/sbin/priority.pl -->
+ <priority>299</priority>
</properties>
<children>
<leafNode name="bind-to-all">
@@ -15,17 +15,63 @@
</leafNode>
<tagNode name="name">
<properties>
- <help>VRF instance name</help>
+ <help>Virtual Routing and Forwarding instance</help>
<constraint>
<validator name="vrf-name"/>
</constraint>
<constraintErrorMessage>VRF instance name must be 15 characters or less and can not\nbe named as regular network interfaces.\n</constraintErrorMessage>
<valueHelp>
<format>txt</format>
- <description>Instance name</description>
+ <description>VRF instance name</description>
</valueHelp>
</properties>
<children>
+ #include <include/interface/interface-description.xml.i>
+ #include <include/interface/interface-disable.xml.i>
+ <node name="protocols">
+ <properties>
+ <help>Routing protocol parameters</help>
+ </properties>
+ <children>
+ <node name="bgp" owner="${vyos_conf_scripts_dir}/protocols_bgp.py $VAR(../../@)">
+ <properties>
+ <help>Border Gateway Protocol (BGP)</help>
+ <priority>821</priority>
+ </properties>
+ <children>
+ #include <include/bgp/bgp-common-config.xml.i>
+ </children>
+ </node>
+ <node name="isis" owner="${vyos_conf_scripts_dir}/protocols_isis.py $VAR(../../@)">
+ <properties>
+ <help>Intermediate System to Intermediate System (IS-IS)</help>
+ <priority>611</priority>
+ </properties>
+ <children>
+ #include <include/isis/isis-common-config.xml.i>
+ </children>
+ </node>
+ <node name="ospf" owner="${vyos_conf_scripts_dir}/protocols_ospf.py $VAR(../../@)">
+ <properties>
+ <help>Open Shortest Path First (OSPF)</help>
+ <priority>621</priority>
+ </properties>
+ <children>
+ #include <include/ospf/ospf-common-config.xml.i>
+ </children>
+ </node>
+ <node name="static" owner="${vyos_conf_scripts_dir}/protocols_static.py $VAR(../../@)">
+ <properties>
+ <help>Static route parameters</help>
+ <priority>481</priority>
+ </properties>
+ <children>
+ #include <include/static/static-route.xml.i>
+ #include <include/static/static-route6.xml.i>
+ </children>
+ </node>
+ </children>
+ </node>
<leafNode name="table">
<properties>
<help>Routing table associated with this instance</help>
@@ -39,8 +85,6 @@
<constraintErrorMessage>VRF routing table must be in range from 100 to 2147483647</constraintErrorMessage>
</properties>
</leafNode>
- #include <include/interface-description.xml.i>
- #include <include/interface-disable.xml.i>
</children>
</tagNode>
</children>
diff --git a/op-mode-definitions/include/bgp-common.xml.i b/op-mode-definitions/include/bgp-common.xml.i
new file mode 100644
index 000000000..a1154d965
--- /dev/null
+++ b/op-mode-definitions/include/bgp-common.xml.i
@@ -0,0 +1,170 @@
+<!-- included start from bgp-common.xml.i -->
+<leafNode name="attribute-info">
+ <properties>
+ <help>Show BGP attribute information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+</leafNode>
+<leafNode name="cidr-only">
+ <properties>
+ <help>Display only routes with non-natural netmasks</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+</leafNode>
+<leafNode name="community-info">
+ <properties>
+ <help>List all bgp community information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+</leafNode>
+#include <include/bgp-afi-common.xml.i>
+#include <include/bgp-afi-ipv4-ipv6-common.xml.i>
+<tagNode name="prefix-list">
+ <properties>
+ <completionHelp>
+ <path>policy prefix-list</path>
+ </completionHelp>
+ </properties>
+</tagNode>
+<node name="ipv4">
+ <properties>
+ <help>Show BGP IPv4 information</help>
+ </properties>
+ <children>
+ <node name="unicast">
+ <properties>
+ <help>Show BGP IPv4 unicast information</help>
+ </properties>
+ <children>
+ <leafNode name="cidr-only">
+ <properties>
+ <help>Display only routes with non-natural netmasks</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ <node name="community">
+ <properties>
+ <help>Show BGP routes matching the communities</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </node>
+ <tagNode name="community">
+ <properties>
+ <help>Display routes matching the specified communities</help>
+ <completionHelp>
+<list>&lt;AA:NN&gt; local-AS no-advertise no-export</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <tagNode name="community-list">
+ <properties>
+ <help>Show BGP routes matching specified community list</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <leafNode name="exact-match">
+<properties>
+ <help>Show BGP routes exactly matching specified community list</help>
+</properties>
+<command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ </children>
+ </tagNode>
+ <tagNode name="neighbors">
+ <properties>
+ <help>Show detailed BGP IPv4 unicast neighbor information</help>
+ <completionHelp>
+<script>vtysh -c "show ip bgp ipv4 unicast summary" | awk '{print $1}' | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b"</script>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <leafNode name="advertised-routes">
+<properties>
+ <help>Show routes advertised to a BGP neighbor</help>
+</properties>
+<command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ <leafNode name="prefix-counts">
+<properties>
+ <help>Show detailed prefix count information</help>
+</properties>
+<command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ <leafNode name="received-routes">
+<properties>
+ <help>Show the received routes from neighbor</help>
+</properties>
+<command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ <leafNode name="routes">
+<properties>
+ <help>Show routes learned from neighbor</help>
+</properties>
+<command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ </children>
+ </tagNode>
+ <leafNode name="paths">
+ <properties>
+ <help>Show BGP path information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ <tagNode name="prefix-list">
+ <properties>
+ <help>Show BGP routes matching the specified prefix list</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <tagNode name="regexp">
+ <properties>
+ <help>Show BGP routes matching the specified AS path regular expression</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <tagNode name="route-map">
+ <properties>
+ <help>Show BGP routes matching the specified route map</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <leafNode name="summary">
+ <properties>
+ <help>Show summary of BGP information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ </children>
+ </node>
+ <tagNode name="unicast">
+ <properties>
+ <help>Show BGP information for specified IP address or prefix</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt; &lt;x.x.x.x/x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ </children>
+</node>
+<leafNode name="large-community-info">
+ <properties>
+ <help>Show BGP large-community information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+</leafNode>
+<leafNode name="memory">
+ <properties>
+ <help>Show BGP memory usage</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+</leafNode>
+<leafNode name="paths">
+ <properties>
+ <help>Show BGP path information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+</leafNode>
+<!-- included end -->
diff --git a/op-mode-definitions/include/isis-common.xml.i b/op-mode-definitions/include/isis-common.xml.i
new file mode 100644
index 000000000..b1ee3e241
--- /dev/null
+++ b/op-mode-definitions/include/isis-common.xml.i
@@ -0,0 +1,179 @@
+<!-- included start from isis-common.xml.i -->
+<node name="database">
+ <properties>
+ <help>Show IS-IS link state database</help>
+ </properties>
+ <children>
+ <leafNode name="detail">
+ <properties>
+ <help>Show detailed information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ </children>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+</node>
+<tagNode name="database">
+ <properties>
+ <help>Show IS-IS link state database PDU</help>
+ <completionHelp>
+ <list>lsp-id detail</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+</tagNode>
+<leafNode name="hostname">
+ <properties>
+ <help>Show IS-IS dynamic hostname mapping</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+</leafNode>
+<node name="interface">
+ <properties>
+ <help>Show IS-IS interfaces</help>
+ <completionHelp>
+ <script>${vyos_completion_dir}/list_interfaces.py</script>
+ </completionHelp>
+ </properties>
+ <children>
+ <leafNode name="detail">
+ <properties>
+ <help>Show detailed information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ </children>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+</node>
+<tagNode name="interface">
+ <properties>
+ <help>Show specific IS-IS interface</help>
+ <completionHelp>
+ <script>${vyos_completion_dir}/list_interfaces.py</script>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+</tagNode>
+<node name="mpls-te">
+ <properties>
+ <help>Show IS-IS MPLS traffic engineering information</help>
+ </properties>
+ <children>
+ <leafNode name="router">
+ <properties>
+ <help>Show router information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ <leafNode name="interface">
+ <properties>
+ <help>Show interface information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ <tagNode name="interface">
+ <properties>
+ <help>Show specific IS-IS interface</help>
+ <completionHelp>
+ <script>${vyos_completion_dir}/list_interfaces.py</script>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ </children>
+</node>
+<node name="neighbor">
+ <properties>
+ <help>Show IS-IS neighbor adjacencies</help>
+ </properties>
+ <children>
+ <leafNode name="detail">
+ <properties>
+ <help>Show detailed information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ </children>
+ <command>vtysh -c "show isis neighbor"</command>
+</node>
+<tagNode name="neighbor">
+ <properties>
+ <help>Show specific IS-IS neighbor adjacency </help>
+ <completionHelp>
+ <list>system-id</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+</tagNode>
+<node name="route">
+ <properties>
+ <help>Show IS-IS routing table</help>
+ </properties>
+ <children>
+ <leafNode name="level-1">
+ <properties>
+ <help>Show level-1 routes</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ <leafNode name="level-2">
+ <properties>
+ <help>Show level-2 routes</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ </children>
+ <command>vtysh -c "show isis route"</command>
+</node>
+<node name="segment-routing">
+ <properties>
+ <help>Show IS-IS Segment-Routing (SPRING) information</help>
+ </properties>
+ <children>
+ <leafNode name="node">
+ <properties>
+ <help>Show node information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ <leafNode name="prefix-sids">
+ <properties>
+ <help>Show prefix segment IDs</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ </children>
+</node>
+<leafNode name="spf-delay-ietf">
+ <properties>
+ <help>Show IS-IS SPF delay parameters</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+</leafNode>
+<leafNode name="summary">
+ <properties>
+ <help>Show IS-IS information summary</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+</leafNode>
+<node name="topology">
+ <properties>
+ <help>Show IS-IS paths to Intermediate Systems</help>
+ </properties>
+ <children>
+ <leafNode name="level-1">
+ <properties>
+ <help>Show level-1 routes</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ <leafNode name="level-2">
+ <properties>
+ <help>Show level-2 routes</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ </children>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+</node>
+<!-- included end -->
diff --git a/op-mode-definitions/include/ospf-common.xml.i b/op-mode-definitions/include/ospf-common.xml.i
new file mode 100644
index 000000000..0edc3c37f
--- /dev/null
+++ b/op-mode-definitions/include/ospf-common.xml.i
@@ -0,0 +1,559 @@
+<!-- included start from ospf-common.xml.i -->
+<leafNode name="border-routers">
+ <properties>
+ <help>Show IPv4 OSPF border-routers information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+</leafNode>
+<node name="database">
+ <properties>
+ <help>Show IPv4 OSPF database information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <node name="asbr-summary">
+ <properties>
+ <help>Show IPv4 OSPF ASBR summary database</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <tagNode name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF ASBR summary database for given address of advertised router</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <node name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF ASBR summary database for given address of advertised router</help>
+ </properties>
+ </node>
+ </children>
+ </node>
+ <tagNode name="asbr-summary">
+ <properties>
+ <help>Show IPv4 OSPF ASBR summary database information of given address</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <node name="adv-router">
+ <properties>
+ <help>Show advertising router link states</help>
+ </properties>
+ </node>
+ <tagNode name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF ASBR summary database of given address for given advertised router</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <leafNode name="self-originate">
+ <properties>
+ <help>Show summary of self-originate IPv4 OSPF ASBR database</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ </children>
+ </tagNode>
+ <node name="external">
+ <properties>
+ <help>Show IPv4 OSPF external database</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <tagNode name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF external database for specified IP address of advertised router</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <node name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF external database for specified IP address of advertised router</help>
+ </properties>
+ </node>
+ </children>
+ </node>
+ <tagNode name="external">
+ <properties>
+ <help>Show IPv4 OSPF external database information of specified IP address</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <node name="adv-router">
+ <properties>
+ <help>Show advertising router link states</help>
+ </properties>
+ </node>
+ <tagNode name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF external database of specified IP address for specified advertised router</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <leafNode name="self-originate">
+ <properties>
+ <help>Show self-originate IPv4 OSPF external database</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ </children>
+ </tagNode>
+ <leafNode name="max-age">
+ <properties>
+ <help>Show IPv4 OSPF max-age database</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ <node name="network">
+ <properties>
+ <help>Show IPv4 OSPF network database</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <tagNode name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF network database for specified IP address of advertised router</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <node name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF network database for given address of advertised router</help>
+ </properties>
+ </node>
+ </children>
+ </node>
+ <tagNode name="network">
+ <properties>
+ <help>Show IPv4 OSPF network database information of specified IP address</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <node name="adv-router">
+ <properties>
+ <help>Show advertising router link states</help>
+ </properties>
+ </node>
+ <tagNode name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF network database of specified IP address for specified advertised router</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <leafNode name="self-originate">
+ <properties>
+ <help>Show self-originate IPv4 OSPF network database</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ </children>
+ </tagNode>
+ <node name="nssa-external">
+ <properties>
+ <help>Show IPv4 OSPF NSSA external database</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <tagNode name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF NSSA external database for specified IP address of advertised router</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <node name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF NSSA external database for specified IP address of advertised router</help>
+ </properties>
+ </node>
+ </children>
+ </node>
+ <tagNode name="nssa-external">
+ <properties>
+ <help>Show IPv4 OSPF NSSA external database information of specified IP address</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <node name="adv-router">
+ <properties>
+ <help>Show advertising router link states</help>
+ </properties>
+ </node>
+ <tagNode name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF NSSA external database of specified IP address for specified advertised router</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <leafNode name="self-originate">
+ <properties>
+ <help>Show self-originate IPv4 OSPF NSSA external database</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ </children>
+ </tagNode>
+ <node name="opaque-area">
+ <properties>
+ <help>Show IPv4 OSPF opaque-area database</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <tagNode name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF opaque-area database for specified IP address of advertised router</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <node name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF opaque-area database for specified IP address of advertised router</help>
+ </properties>
+ </node>
+ </children>
+ </node>
+ <tagNode name="opaque-area">
+ <properties>
+ <help>Show IPv4 OSPF opaque-area database information of specified IP address</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <node name="adv-router">
+ <properties>
+ <help>Show advertising router link states</help>
+ </properties>
+ </node>
+ <tagNode name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF opaque-area database of specified IP address for specified advertised router</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <leafNode name="self-originate">
+ <properties>
+ <help>Show self-originate IPv4 OSPF opaque-area database</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ </children>
+ </tagNode>
+ <node name="opaque-as">
+ <properties>
+ <help>Show IPv4 OSPF opaque-as database</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <tagNode name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF opaque-as database for specified IP address of advertised router</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <node name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF opaque-as database for specified IP address of advertised router</help>
+ </properties>
+ </node>
+ </children>
+ </node>
+ <tagNode name="opaque-as">
+ <properties>
+ <help>Show IPv4 OSPF opaque-as database information of specified IP address</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <node name="adv-router">
+ <properties>
+ <help>Show advertising router link states</help>
+ </properties>
+ </node>
+ <tagNode name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF opaque-as database of specified IP address for specified advertised router</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <leafNode name="self-originate">
+ <properties>
+ <help>Show self-originate IPv4 OSPF opaque-as database</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ </children>
+ </tagNode>
+ <node name="opaque-link">
+ <properties>
+ <help>Show IPv4 OSPF opaque-link database</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <tagNode name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF opaque-link database for specified IP address of advertised router</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <node name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF opaque-link database for specified IP address of advertised router</help>
+ </properties>
+ </node>
+ </children>
+ </node>
+ <tagNode name="opaque-link">
+ <properties>
+ <help>Show IPv4 OSPF opaque-link database information of specified IP address</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <node name="adv-router">
+ <properties>
+ <help>Show advertising router link states</help>
+ </properties>
+ </node>
+ <tagNode name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF opaque-link database of specified IP address for specified advertised router</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <leafNode name="self-originate">
+ <properties>
+ <help>Show self-originate IPv4 OSPF opaque-link database</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ </children>
+ </tagNode>
+ <node name="router">
+ <properties>
+ <help>Show IPv4 OSPF router database</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <tagNode name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF router database for specified IP address of advertised router</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <node name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF router database for specified IP address of advertised router</help>
+ </properties>
+ </node>
+ </children>
+ </node>
+ <tagNode name="router">
+ <properties>
+ <help>Show IPv4 OSPF router database information of specified IP address</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <node name="adv-router">
+ <properties>
+ <help>Show advertising router link states</help>
+ </properties>
+ </node>
+ <tagNode name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF router database of specified IP address for specified advertised router</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <leafNode name="self-originate">
+ <properties>
+ <help>Show self-originate IPv4 OSPF router database</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ </children>
+ </tagNode>
+ <leafNode name="self-originate">
+ <properties>
+ <help>Show IPv4 OSPF self-originate database</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ <node name="summary">
+ <properties>
+ <help>Show summary of IPv4 OSPF database</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <tagNode name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF summary database for specified IP address of advertised router</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <node name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF summary database for specified IP address of advertised router</help>
+ </properties>
+ </node>
+ </children>
+ </node>
+ <tagNode name="summary">
+ <properties>
+ <help>Show IPv4 OSPF summary database information of specified IP address</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <node name="adv-router">
+ <properties>
+ <help>Show advertising router link states</help>
+ </properties>
+ </node>
+ <tagNode name="adv-router">
+ <properties>
+ <help>Show IPv4 OSPF summary database of specified IP address for specified advertised router</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <leafNode name="self-originate">
+ <properties>
+ <help>Show self-originate IPv4 OSPF summary database</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </leafNode>
+ </children>
+ </tagNode>
+ </children>
+</node>
+<node name="interface">
+ <properties>
+ <help>Show IPv4 OSPF interface information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+</node>
+<tagNode name="interface">
+ <properties>
+ <help>Show IPv4 OSPF information for specified interface</help>
+ <completionHelp>
+ <script>${vyos_completion_dir}/list_interfaces.py</script>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+</tagNode>
+<node name="neighbor">
+ <properties>
+ <help>Show IPv4 OSPF neighbor information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <tagNode name="address">
+ <properties>
+ <help>Show IPv4 OSPF neighbor information for specified IP address</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </tagNode>
+ <node name="detail">
+ <properties>
+ <help>Show detailed IPv4 OSPF neighbor information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </node>
+ </children>
+</node>
+<tagNode name="neighbor">
+ <properties>
+ <help>Show IPv4 OSPF neighbor information for specified IP address or interface</help>
+ <completionHelp>
+ <list>&lt;x.x.x.x&gt;</list>
+ <script>${vyos_completion_dir}/list_interfaces.py</script>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+</tagNode>
+<leafNode name="route">
+ <properties>
+ <help>Show IPv4 OSPF route information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+</leafNode>
+<!-- included end -->
diff --git a/op-mode-definitions/nat.xml.in b/op-mode-definitions/nat.xml.in
index 4b09816f9..084e2e7e3 100644
--- a/op-mode-definitions/nat.xml.in
+++ b/op-mode-definitions/nat.xml.in
@@ -4,19 +4,19 @@
<children>
<node name="nat">
<properties>
- <help>Show Network Address Translation (NAT) information</help>
+ <help>Show IPv4 to IPv4 Network Address Translation (NAT) information</help>
</properties>
<children>
<node name="source">
<properties>
- <help>Show source Network Address Translation (NAT) information</help>
+ <help>Show source IPv4 to IPv4 Network Address Translation (NAT) information</help>
</properties>
<children>
<node name="rules">
<properties>
<help>Show configured source NAT rules</help>
</properties>
- <command>echo To be migrated to Python - Phabricator T2459</command>
+ <command>${vyos_op_scripts_dir}/show_nat_rules.py --source</command>
</node>
<node name="statistics">
<properties>
@@ -51,14 +51,14 @@
</node>
<node name="destination">
<properties>
- <help>Show destination Network Address Translation (NAT) information</help>
+ <help>Show destination IPv4 to IPv4 Network Address Translation (NAT) information</help>
</properties>
<children>
<node name="rules">
<properties>
<help>Show configured destination NAT rules</help>
</properties>
- <command>echo To be migrated to Python - Phabricator T2459</command>
+ <command>${vyos_op_scripts_dir}/show_nat_rules.py --destination</command>
</node>
<node name="statistics">
<properties>
diff --git a/op-mode-definitions/nat66.xml.in b/op-mode-definitions/nat66.xml.in
new file mode 100644
index 000000000..1ec46eb11
--- /dev/null
+++ b/op-mode-definitions/nat66.xml.in
@@ -0,0 +1,98 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<interfaceDefinition>
+ <node name="show">
+ <children>
+ <node name="nat66">
+ <properties>
+ <help>Show IPv6 to IPv6 Network Address Translation (NAT66) information</help>
+ </properties>
+ <children>
+ <node name="source">
+ <properties>
+ <help>Show source IPv6 to IPv6 Network Address Translation (NAT66) information</help>
+ </properties>
+ <children>
+ <node name="rules">
+ <properties>
+ <help>Show configured source NAT66 rules</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/show_nat66_rules.py --source</command>
+ </node>
+ <node name="statistics">
+ <properties>
+ <help>Show statistics for configured source NAT66 rules</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/show_nat66_statistics.py --source</command>
+ </node>
+ <node name="translations">
+ <properties>
+ <help>Show active source NAT66 translations</help>
+ </properties>
+ <children>
+ <tagNode name="address">
+ <properties>
+ <help>Show active source NAT66 translations for an IPv6 address</help>
+ <completionHelp>
+ <list>&lt;h:h:h:h:h:h:h:h&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/show_nat66_translations.py --type=source --verbose --ipaddr="$6"</command>
+ </tagNode>
+ <node name="detail">
+ <properties>
+ <help>Show active source NAT66 translations detail</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/show_nat66_translations.py --type=source --verbose</command>
+ </node>
+ </children>
+ <command>${vyos_op_scripts_dir}/show_nat66_translations.py --type=source</command>
+ </node>
+ </children>
+ </node>
+ <node name="destination">
+ <properties>
+ <help>Show destination IPv6 to IPv6 Network Address Translation (NAT66) information</help>
+ </properties>
+ <children>
+ <node name="rules">
+ <properties>
+ <help>Show configured destination NAT66 rules</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/show_nat66_rules.py --destination</command>
+ </node>
+ <node name="statistics">
+ <properties>
+ <help>Show statistics for configured destination NAT66 rules</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/show_nat66_statistics.py --destination</command>
+ </node>
+ <node name="translations">
+ <properties>
+ <help>Show active destination NAT66 translations</help>
+ </properties>
+ <children>
+ <tagNode name="address">
+ <properties>
+ <help>Show active NAT66 destination translations for an IPv6 address</help>
+ <completionHelp>
+ <list>&lt;h:h:h:h:h:h:h:h&gt;</list>
+ </completionHelp>
+ </properties>
+ <command>${vyos_op_scripts_dir}/show_nat66_translations.py --type=destination --verbose --ipaddr="$6"</command>
+ </tagNode>
+ <node name="detail">
+ <properties>
+ <help>Show active destination NAT66 translations detail</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/show_nat66_translations.py --type=destination --verbose</command>
+ </node>
+ </children>
+ <command>${vyos_op_scripts_dir}/show_nat66_translations.py --type=destination</command>
+ </node>
+ </children>
+ </node>
+ </children>
+ </node>
+ </children>
+ </node>
+</interfaceDefinition>
diff --git a/op-mode-definitions/show-ip-bgp.xml.in b/op-mode-definitions/show-ip-bgp.xml.in
index 690de0a1d..9a271b4a5 100644
--- a/op-mode-definitions/show-ip-bgp.xml.in
+++ b/op-mode-definitions/show-ip-bgp.xml.in
@@ -10,174 +10,19 @@
</properties>
<command>vtysh -c "show ip bgp"</command>
<children>
- <leafNode name="attribute-info">
- <properties>
- <help>Show BGP attribute information</help>
- </properties>
- <command>vtysh -c "show ip bgp attribute-info"</command>
- </leafNode>
- <leafNode name="cidr-only">
- <properties>
- <help>Display only routes with non-natural netmasks</help>
- </properties>
- <command>vtysh -c "show ip bgp cidr-only"</command>
- </leafNode>
- <leafNode name="community-info">
- <properties>
- <help>List all bgp community information</help>
- </properties>
- <command>vtysh -c "show ip bgp community-info"</command>
- </leafNode>
- #include <include/bgp-afi-common.xml.i>
- #include <include/bgp-afi-ipv4-ipv6-common.xml.i>
- <tagNode name="prefix-list">
+ #include <include/bgp-common.xml.i>
+ <tagNode name="vrf">
<properties>
+ <help>Show bgp routing protocol for given VRF</help>
<completionHelp>
- <path>policy prefix-list</path>
+ <path>vrf name</path>
+ <list>all</list>
</completionHelp>
</properties>
- </tagNode>
- <node name="ipv4">
- <properties>
- <help>Show BGP IPv4 information</help>
- </properties>
<children>
- <node name="unicast">
- <properties>
- <help>Show BGP IPv4 unicast information</help>
- </properties>
- <children>
- <leafNode name="cidr-only">
- <properties>
- <help>Display only routes with non-natural netmasks</help>
- </properties>
- <command>vtysh -c "show ip bgp ipv4 unicast cidr-only"</command>
- </leafNode>
- <node name="community"> <!-- START new code -->
- <properties>
- <help>Show BGP routes matching the communities</help>
- </properties>
- <command>vtysh -c "show ip bgp ipv4 unicast community"</command>
- </node>
- <tagNode name="community">
- <properties>
- <help>Display routes matching the specified communities</help>
- <completionHelp>
- <list>&lt;AA:NN&gt; local-AS no-advertise no-export</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip bgp ipv4 unicast community $7"</command>
- </tagNode>
- <tagNode name="community-list">
- <properties>
- <help>Show BGP routes matching specified community list</help>
- </properties>
- <command>vtysh -c "show ip bgp ipv4 unicast community-list $7"</command>
- <children>
- <leafNode name="exact-match">
- <properties>
- <help>Show BGP routes exactly matching specified community list</help>
- </properties>
- <command>vtysh -c "show ip bgp ipv4 unicast community-list $7 exact-match"</command>
- </leafNode>
- </children>
- </tagNode>
- <tagNode name="neighbors">
- <properties>
- <help>Show detailed BGP IPv4 unicast neighbor information</help>
- <completionHelp>
- <script>vtysh -c "show ip bgp ipv4 unicast summary" | awk '{print $1}' | grep -oE "\b([0-9]{1,3}\.){3}[0-9]{1,3}\b"</script>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip bgp ipv4 unicast neighbors $7"</command>
- <children>
- <leafNode name="advertised-routes">
- <properties>
- <help>Show routes advertised to a BGP neighbor</help>
- </properties>
- <command>vtysh -c "show ip bgp ipv4 unicast neighbor $7 advertised-routes"</command>
- </leafNode>
- <leafNode name="prefix-counts">
- <properties>
- <help>Show detailed prefix count information</help>
- </properties>
- <command>vtysh -c "show ip bgp ipv4 unicast neighbor $7 prefix-counts"</command>
- </leafNode>
- <leafNode name="received-routes">
- <properties>
- <help>Show the received routes from neighbor</help>
- </properties>
- <command>vtysh -c "show ip bgp ipv4 unicast neighbor $7 received-routes"</command>
- </leafNode>
- <leafNode name="routes">
- <properties>
- <help>Show routes learned from neighbor</help>
- </properties>
- <command>vtysh -c "show ip bgp ipv4 unicast neighbor $7 routes"</command>
- </leafNode>
- </children>
- </tagNode>
- <leafNode name="paths">
- <properties>
- <help>Show BGP path information</help>
- </properties>
- <command>vtysh -c "show ip bgp ipv4 unicast paths"</command>
- </leafNode>
- <tagNode name="prefix-list">
- <properties>
- <help>Show BGP routes matching the specified prefix list</help>
- </properties>
- <command>vtysh -c "show ip bgp ipv4 unicast prefix-list $7"</command>
- </tagNode>
- <tagNode name="regexp">
- <properties>
- <help>Show BGP routes matching the specified AS path regular expression</help>
- </properties>
- <command>vtysh -c "show ip bgp ipv4 unicast regexp $5"</command>
- </tagNode>
- <tagNode name="route-map">
- <properties>
- <help>Show BGP routes matching the specified route map</help>
- </properties>
- <command>vtysh -c "show ip bgp route-map $5"</command>
- </tagNode>
- <leafNode name="summary">
- <properties>
- <help>Show summary of BGP information</help>
- </properties>
- <command>vtysh -c "show ip bgp summary"</command>
- </leafNode>
- </children>
- </node>
- <tagNode name="unicast">
- <properties>
- <help>Show BGP information for specified IP address or prefix</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt; &lt;x.x.x.x/x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip bgp $6"</command>
- </tagNode>
+ #include <include/bgp-common.xml.i>
</children>
- </node>
- <leafNode name="large-community-info">
- <properties>
- <help>Show BGP large-community information</help>
- </properties>
- <command>vtysh -c "show ip bgp large-community-info"</command>
- </leafNode>
- <leafNode name="memory">
- <properties>
- <help>Show BGP memory usage</help>
- </properties>
- <command>vtysh -c "show ip bgp memory"</command>
- </leafNode>
- <leafNode name="paths">
- <properties>
- <help>Show BGP path information</help>
- </properties>
- <command>vtysh -c "show ip bgp paths"</command>
- </leafNode>
+ </tagNode>
</children>
</node>
</children>
diff --git a/op-mode-definitions/show-ip-ospf.xml.in b/op-mode-definitions/show-ip-ospf.xml.in
index fc298123b..704ed984f 100644
--- a/op-mode-definitions/show-ip-ospf.xml.in
+++ b/op-mode-definitions/show-ip-ospf.xml.in
@@ -11,565 +11,22 @@
<properties>
<help>Show IPv4 Open Shortest Path First (OSPF) routing information</help>
</properties>
- <command>vtysh -c "show ip ospf"</command>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
<children>
- <leafNode name="border-routers">
+ #include <include/ospf-common.xml.i>
+ <tagNode name="vrf">
<properties>
- <help>Show IPv4 OSPF border-routers information</help>
- </properties>
- <command>vtysh -c "show ip ospf border-routers"</command>
- </leafNode>
- <node name="database">
- <properties>
- <help>Show IPv4 OSPF database information</help>
- </properties>
- <command>vtysh -c "show ip ospf database"</command>
- <children>
- <node name="asbr-summary">
- <properties>
- <help>Show IPv4 OSPF ASBR summary database</help>
- </properties>
- <command>vtysh -c "show ip ospf database asbr-summary"</command>
- <children>
- <tagNode name="adv-router">
- <properties>
- <help>Show IPv4 OSPF ASBR summary database for given address of advertised router</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database asbr-summary adv-router $7"</command>
- </tagNode>
- <node name="adv-router">
- <properties>
- <help>Show IPv4 OSPF ASBR summary database for given address of advertised router</help>
- </properties>
- </node>
- </children>
- </node>
- <tagNode name="asbr-summary">
- <properties>
- <help>Show IPv4 OSPF ASBR summary database information of given address</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database asbr-summary $6"</command>
- <children>
- <node name="adv-router">
- <properties>
- <help>Show advertising router link states</help>
- </properties>
- </node>
- <tagNode name="adv-router">
- <properties>
- <help>Show IPv4 OSPF ASBR summary database of given address for given advertised router</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database asbr-summary $6 adv-router $8"</command>
- </tagNode>
- <leafNode name="self-originate">
- <properties>
- <help>Show summary of self-originate IPv4 OSPF ASBR database</help>
- </properties>
- <command>show ip ospf database asbr-summary $6 self-originate</command>
- </leafNode>
- </children>
- </tagNode>
- <node name="external">
- <properties>
- <help>Show IPv4 OSPF external database</help>
- </properties>
- <command>vtysh -c "show ip ospf database external"</command>
- <children>
- <tagNode name="adv-router">
- <properties>
- <help>Show IPv4 OSPF external database for specified IP address of advertised router</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database external adv-router $7"</command>
- </tagNode>
- <node name="adv-router">
- <properties>
- <help>Show IPv4 OSPF external database for specified IP address of advertised router</help>
- </properties>
- </node>
- </children>
- </node>
- <tagNode name="external">
- <properties>
- <help>Show IPv4 OSPF external database information of specified IP address</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database external $6"</command>
- <children>
- <node name="adv-router">
- <properties>
- <help>Show advertising router link states</help>
- </properties>
- </node>
- <tagNode name="adv-router">
- <properties>
- <help>Show IPv4 OSPF external database of specified IP address for specified advertised router</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database external $6 adv-router $8"</command>
- </tagNode>
- <leafNode name="self-originate">
- <properties>
- <help>Show self-originate IPv4 OSPF external database</help>
- </properties>
- <command>show ip ospf database external $6 self-originate</command>
- </leafNode>
- </children>
- </tagNode>
- <leafNode name="max-age">
- <properties>
- <help>Show IPv4 OSPF max-age database</help>
- </properties>
- <command>vtysh -c "show ip ospf database max-age"</command>
- </leafNode>
- <node name="network">
- <properties>
- <help>Show IPv4 OSPF network database</help>
- </properties>
- <command>vtysh -c "show ip ospf database network"</command>
- <children>
- <tagNode name="adv-router">
- <properties>
- <help>Show IPv4 OSPF network database for specified IP address of advertised router</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database network adv-router $7"</command>
- </tagNode>
- <node name="adv-router">
- <properties>
- <help>Show IPv4 OSPF network database for given address of advertised router</help>
- </properties>
- </node>
- </children>
- </node>
- <tagNode name="network">
- <properties>
- <help>Show IPv4 OSPF network database information of specified IP address</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database network $6"</command>
- <children>
- <node name="adv-router">
- <properties>
- <help>Show advertising router link states</help>
- </properties>
- </node>
- <tagNode name="adv-router">
- <properties>
- <help>Show IPv4 OSPF network database of specified IP address for specified advertised router</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database network $6 adv-router $8"</command>
- </tagNode>
- <leafNode name="self-originate">
- <properties>
- <help>Show self-originate IPv4 OSPF network database</help>
- </properties>
- <command>show ip ospf database network $6 self-originate</command>
- </leafNode>
- </children>
- </tagNode>
- <node name="nssa-external">
- <properties>
- <help>Show IPv4 OSPF NSSA external database</help>
- </properties>
- <command>vtysh -c "show ip ospf database nssa-external"</command>
- <children>
- <tagNode name="adv-router">
- <properties>
- <help>Show IPv4 OSPF NSSA external database for specified IP address of advertised router</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database nssa-external adv-router $7"</command>
- </tagNode>
- <node name="adv-router">
- <properties>
- <help>Show IPv4 OSPF NSSA external database for specified IP address of advertised router</help>
- </properties>
- </node>
- </children>
- </node>
- <tagNode name="nssa-external">
- <properties>
- <help>Show IPv4 OSPF NSSA external database information of specified IP address</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database nssa-external $6"</command>
- <children>
- <node name="adv-router">
- <properties>
- <help>Show advertising router link states</help>
- </properties>
- </node>
- <tagNode name="adv-router">
- <properties>
- <help>Show IPv4 OSPF NSSA external database of specified IP address for specified advertised router</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database nssa-external $6 adv-router $8"</command>
- </tagNode>
- <leafNode name="self-originate">
- <properties>
- <help>Show self-originate IPv4 OSPF NSSA external database</help>
- </properties>
- <command>show ip ospf database nssa-external $6 self-originate</command>
- </leafNode>
- </children>
- </tagNode>
- <node name="opaque-area">
- <properties>
- <help>Show IPv4 OSPF opaque-area database</help>
- </properties>
- <command>vtysh -c "show ip ospf database opaque-area"</command>
- <children>
- <tagNode name="adv-router">
- <properties>
- <help>Show IPv4 OSPF opaque-area database for specified IP address of advertised router</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database opaque-area adv-router $7"</command>
- </tagNode>
- <node name="adv-router">
- <properties>
- <help>Show IPv4 OSPF opaque-area database for specified IP address of advertised router</help>
- </properties>
- </node>
- </children>
- </node>
- <tagNode name="opaque-area">
- <properties>
- <help>Show IPv4 OSPF opaque-area database information of specified IP address</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database opaque-area $6"</command>
- <children>
- <node name="adv-router">
- <properties>
- <help>Show advertising router link states</help>
- </properties>
- </node>
- <tagNode name="adv-router">
- <properties>
- <help>Show IPv4 OSPF opaque-area database of specified IP address for specified advertised router</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database opaque-area $6 adv-router $8"</command>
- </tagNode>
- <leafNode name="self-originate">
- <properties>
- <help>Show self-originate IPv4 OSPF opaque-area database</help>
- </properties>
- <command>show ip ospf database opaque-area $6 self-originate</command>
- </leafNode>
- </children>
- </tagNode>
- <node name="opaque-as">
- <properties>
- <help>Show IPv4 OSPF opaque-as database</help>
- </properties>
- <command>vtysh -c "show ip ospf database opaque-as"</command>
- <children>
- <tagNode name="adv-router">
- <properties>
- <help>Show IPv4 OSPF opaque-as database for specified IP address of advertised router</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database opaque-as adv-router $7"</command>
- </tagNode>
- <node name="adv-router">
- <properties>
- <help>Show IPv4 OSPF opaque-as database for specified IP address of advertised router</help>
- </properties>
- </node>
- </children>
- </node>
- <tagNode name="opaque-as">
- <properties>
- <help>Show IPv4 OSPF opaque-as database information of specified IP address</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database opaque-as $6"</command>
- <children>
- <node name="adv-router">
- <properties>
- <help>Show advertising router link states</help>
- </properties>
- </node>
- <tagNode name="adv-router">
- <properties>
- <help>Show IPv4 OSPF opaque-as database of specified IP address for specified advertised router</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database opaque-as $6 adv-router $8"</command>
- </tagNode>
- <leafNode name="self-originate">
- <properties>
- <help>Show self-originate IPv4 OSPF opaque-as database</help>
- </properties>
- <command>show ip ospf database opaque-as $6 self-originate</command>
- </leafNode>
- </children>
- </tagNode>
- <node name="opaque-link">
- <properties>
- <help>Show IPv4 OSPF opaque-link database</help>
- </properties>
- <command>vtysh -c "show ip ospf database opaque-link"</command>
- <children>
- <tagNode name="adv-router">
- <properties>
- <help>Show IPv4 OSPF opaque-link database for specified IP address of advertised router</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database opaque-link adv-router $7"</command>
- </tagNode>
- <node name="adv-router">
- <properties>
- <help>Show IPv4 OSPF opaque-link database for specified IP address of advertised router</help>
- </properties>
- </node>
- </children>
- </node>
- <tagNode name="opaque-link">
- <properties>
- <help>Show IPv4 OSPF opaque-link database information of specified IP address</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database opaque-link $6"</command>
- <children>
- <node name="adv-router">
- <properties>
- <help>Show advertising router link states</help>
- </properties>
- </node>
- <tagNode name="adv-router">
- <properties>
- <help>Show IPv4 OSPF opaque-link database of specified IP address for specified advertised router</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database opaque-link $6 adv-router $8"</command>
- </tagNode>
- <leafNode name="self-originate">
- <properties>
- <help>Show self-originate IPv4 OSPF opaque-link database</help>
- </properties>
- <command>show ip ospf database opaque-link $6 self-originate</command>
- </leafNode>
- </children>
- </tagNode>
- <node name="router">
- <properties>
- <help>Show IPv4 OSPF router database</help>
- </properties>
- <command>vtysh -c "show ip ospf database router"</command>
- <children>
- <tagNode name="adv-router">
- <properties>
- <help>Show IPv4 OSPF router database for specified IP address of advertised router</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database router adv-router $7"</command>
- </tagNode>
- <node name="adv-router">
- <properties>
- <help>Show IPv4 OSPF router database for specified IP address of advertised router</help>
- </properties>
- </node>
- </children>
- </node>
- <tagNode name="router">
- <properties>
- <help>Show IPv4 OSPF router database information of specified IP address</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database router $6"</command>
- <children>
- <node name="adv-router">
- <properties>
- <help>Show advertising router link states</help>
- </properties>
- </node>
- <tagNode name="adv-router">
- <properties>
- <help>Show IPv4 OSPF router database of specified IP address for specified advertised router</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database router $6 adv-router $8"</command>
- </tagNode>
- <leafNode name="self-originate">
- <properties>
- <help>Show self-originate IPv4 OSPF router database</help>
- </properties>
- <command>show ip ospf database router $6 self-originate</command>
- </leafNode>
- </children>
- </tagNode>
- <leafNode name="self-originate">
- <properties>
- <help>Show IPv4 OSPF self-originate database</help>
- </properties>
- <command>vtysh -c "show ip ospf database self-originate"</command>
- </leafNode>
- <node name="summary">
- <properties>
- <help>Show summary of IPv4 OSPF database</help>
- </properties>
- <command>vtysh -c "show ip ospf database summary"</command>
- <children>
- <tagNode name="adv-router">
- <properties>
- <help>Show IPv4 OSPF summary database for specified IP address of advertised router</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database summary adv-router $7"</command>
- </tagNode>
- <node name="adv-router">
- <properties>
- <help>Show IPv4 OSPF summary database for specified IP address of advertised router</help>
- </properties>
- </node>
- </children>
- </node>
- <tagNode name="summary">
- <properties>
- <help>Show IPv4 OSPF summary database information of specified IP address</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database summary $6"</command>
- <children>
- <node name="adv-router">
- <properties>
- <help>Show advertising router link states</help>
- </properties>
- </node>
- <tagNode name="adv-router">
- <properties>
- <help>Show IPv4 OSPF summary database of specified IP address for specified advertised router</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf database summary $6 adv-router $8"</command>
- </tagNode>
- <leafNode name="self-originate">
- <properties>
- <help>Show self-originate IPv4 OSPF summary database</help>
- </properties>
- <command>show ip ospf database summary $6 self-originate</command>
- </leafNode>
- </children>
- </tagNode>
- </children>
- </node>
- <node name="interface">
- <properties>
- <help>Show IPv4 OSPF interface information</help>
- </properties>
- <command>vtysh -c "show ip ospf interface"</command>
- </node>
- <tagNode name="interface">
- <properties>
- <help>Show IPv4 OSPF information for specified interface</help>
+ <help>Show OSPF routing protocol for given VRF</help>
<completionHelp>
- <script>${vyos_completion_dir}/list_interfaces.py</script>
+ <path>vrf name</path>
+ <list>all</list>
</completionHelp>
</properties>
- <command>vtysh -c "show ip ospf interface $5"</command>
- </tagNode>
- <node name="neighbor">
- <properties>
- <help>Show IPv4 OSPF neighbor information</help>
- </properties>
- <command>vtysh -c "show ip ospf neighbor"</command>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
<children>
- <tagNode name="address">
- <properties>
- <help>Show IPv4 OSPF neighbor information for specified IP address</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf neighbor $6"</command>
- </tagNode>
- <node name="detail">
- <properties>
- <help>Show detailed IPv4 OSPF neighbor information</help>
- </properties>
- <command>vtysh -c "show ip ospf neighbor detail"</command>
- </node>
+ #include <include/ospf-common.xml.i>
</children>
- </node>
- <tagNode name="neighbor">
- <properties>
- <help>Show IPv4 OSPF neighbor information for specified IP address or interface</help>
- <completionHelp>
- <list>&lt;x.x.x.x&gt;</list>
- <script>${vyos_completion_dir}/list_interfaces.py</script>
- </completionHelp>
- </properties>
- <command>vtysh -c "show ip ospf neighbor $5"</command>
</tagNode>
- <leafNode name="route">
- <properties>
- <help>Show IPv4 OSPF route information</help>
- </properties>
- <command>vtysh -c "show ip ospf route"</command>
- </leafNode>
</children>
</node>
</children>
diff --git a/op-mode-definitions/show-isis.xml.in b/op-mode-definitions/show-isis.xml.in
index 890d511e2..202e3214b 100644
--- a/op-mode-definitions/show-isis.xml.in
+++ b/op-mode-definitions/show-isis.xml.in
@@ -4,186 +4,22 @@
<children>
<node name="isis">
<properties>
- <help>IS-IS routing protocol</help>
+ <help>Show IS-IS routing protocol</help>
</properties>
<children>
- <node name="database">
+ #include <include/isis-common.xml.i>
+ <tagNode name="vrf">
<properties>
- <help>Show IS-IS link state database</help>
- </properties>
- <children>
- <leafNode name="detail">
- <properties>
- <help>Show detailed information</help>
- </properties>
- <command>vtysh -c "show isis database detail"</command>
- </leafNode>
- </children>
- <command>vtysh -c "show isis database"</command>
- </node>
- <tagNode name="database">
- <properties>
- <help>Show IS-IS link state database PDU</help>
- <completionHelp>
- <list>lsp-id detail</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show isis database $4"</command>
- </tagNode>
- <leafNode name="hostname">
- <properties>
- <help>Show IS-IS dynamic hostname mapping</help>
- </properties>
- <command>vtysh -c "show isis hostname"</command>
- </leafNode>
- <node name="interface">
- <properties>
- <help>Show IS-IS interfaces</help>
+ <help>Show IS-IS routing protocol for given VRF</help>
<completionHelp>
- <script>${vyos_completion_dir}/list_interfaces.py</script>
+ <path>vrf name</path>
+ <list>all</list>
</completionHelp>
</properties>
<children>
- <leafNode name="detail">
- <properties>
- <help>Show detailed information</help>
- </properties>
- <command>vtysh -c "show isis interface detail"</command>
- </leafNode>
- </children>
- <command>vtysh -c "show isis interface"</command>
- </node>
- <tagNode name="interface">
- <properties>
- <help>Show specific IS-IS interface</help>
- <completionHelp>
- <script>${vyos_completion_dir}/list_interfaces.py</script>
- </completionHelp>
- </properties>
- <command>vtysh -c "show isis interface $4"</command>
- </tagNode>
- <node name="traffic-engineering">
- <properties>
- <help>Show IS-IS MPLS traffic engineering information</help>
- </properties>
- <children>
- <leafNode name="router">
- <properties>
- <help>Show router information</help>
- </properties>
- <command>vtysh -c "show isis mpls-te router"</command>
- </leafNode>
- <leafNode name="interface">
- <properties>
- <help>Show interface information</help>
- </properties>
- <command>vtysh -c "show isis mpls-te interface"</command>
- </leafNode>
- <tagNode name="interface">
- <properties>
- <help>Show specific IS-IS interface</help>
- <completionHelp>
- <script>${vyos_completion_dir}/list_interfaces.py</script>
- </completionHelp>
- </properties>
- <command>vtysh -c "show isis mpls-te interface $5"</command>
- </tagNode>
- </children>
- </node>
- <node name="neighbor">
- <properties>
- <help>Show IS-IS neighbor adjacencies</help>
- </properties>
- <children>
- <leafNode name="detail">
- <properties>
- <help>Show detailed information</help>
- </properties>
- <command>vtysh -c "show isis neighbor detail"</command>
- </leafNode>
+ #include <include/isis-common.xml.i>
</children>
- <command>vtysh -c "show isis neighbor"</command>
- </node>
- <tagNode name="neighbor">
- <properties>
- <help>Show specific IS-IS neighbor adjacency </help>
- <completionHelp>
- <list>system-id</list>
- </completionHelp>
- </properties>
- <command>vtysh -c "show isis neighbor $4"</command>
</tagNode>
- <node name="route">
- <properties>
- <help>Show IS-IS routing table</help>
- </properties>
- <children>
- <leafNode name="level-1">
- <properties>
- <help>Show level-1 routes</help>
- </properties>
- <command>vtysh -c "show isis route level-1"</command>
- </leafNode>
- <leafNode name="level-2">
- <properties>
- <help>Show level-2 routes</help>
- </properties>
- <command>vtysh -c "show isis route level-2"</command>
- </leafNode>
- </children>
- <command>vtysh -c "show isis route"</command>
- </node>
- <node name="segment-routing">
- <properties>
- <help>Show IS-IS Segment-Routing (SPRING) information</help>
- </properties>
- <children>
- <leafNode name="node">
- <properties>
- <help>Show node information</help>
- </properties>
- <command>vtysh -c "show isis segment-routing node"</command>
- </leafNode>
- <leafNode name="prefix-sids">
- <properties>
- <help>Show prefix segment IDs</help>
- </properties>
- <command>vtysh -c "show isis segment-routing prefix-sids"</command>
- </leafNode>
- </children>
- </node>
- <leafNode name="spf-delay">
- <properties>
- <help>Show IS-IS SPF delay parameters</help>
- </properties>
- <command>vtysh -c "show isis spf-delay-ietf"</command>
- </leafNode>
- <leafNode name="summary">
- <properties>
- <help>Show IS-IS information summary</help>
- </properties>
- <command>vtysh -c "show isis summary"</command>
- </leafNode>
- <node name="topology">
- <properties>
- <help>Show IS-IS paths to Intermediate Systems</help>
- </properties>
- <children>
- <leafNode name="level-1">
- <properties>
- <help>Show level-1 routes</help>
- </properties>
- <command>vtysh -c "show isis topology level-1"</command>
- </leafNode>
- <leafNode name="level-2">
- <properties>
- <help>Show level-2 routes</help>
- </properties>
- <command>vtysh -c "show isis topology level-2"</command>
- </leafNode>
- </children>
- <command>vtysh -c "show isis topology"</command>
- </node>
</children>
</node>
</children>
diff --git a/op-mode-definitions/show-ntp.xml.in b/op-mode-definitions/show-ntp.xml.in
index b7f0acdf8..01f4477d8 100644
--- a/op-mode-definitions/show-ntp.xml.in
+++ b/op-mode-definitions/show-ntp.xml.in
@@ -6,7 +6,7 @@
<properties>
<help>Show peer status of NTP daemon</help>
</properties>
- <command>if ps -C ntpd &amp;&gt;/dev/null; then ntpq -n -c peers; else echo NTP daemon disabled; fi</command>
+ <command>${vyos_op_scripts_dir}/show_ntp.sh --basic</command>
<children>
<tagNode name="server">
<properties>
@@ -15,15 +15,14 @@
<script>${vyos_completion_dir}/list_ntp_servers.sh</script>
</completionHelp>
</properties>
- <command>/usr/sbin/ntpdate -q "$4"</command>
+ <command>${vyos_op_scripts_dir}/show_ntp.sh --server "$4"</command>
</tagNode>
<node name="info">
<properties>
<help>Show NTP operational summary</help>
</properties>
- <command>if ps -C ntpd &amp;&gt;/dev/null; then ntpq -n -c sysinfo; ntpq -n -c kerninfo; else echo NTP daemon disabled; fi</command>
- </node>
-
+ <command>${vyos_op_scripts_dir}/show_ntp.sh --info</command>
+ </node>
</children>
</node>
</children>
diff --git a/op-mode-definitions/show-version.xml.in b/op-mode-definitions/show-version.xml.in
index f1e2e2666..6bc49b8cf 100644
--- a/op-mode-definitions/show-version.xml.in
+++ b/op-mode-definitions/show-version.xml.in
@@ -18,7 +18,7 @@
<properties>
<help>Show system version and versions of all packages</help>
</properties>
- <command>echo "Package versions:"; dpkg -l | awk '$0~/>/{exit}1'</command>
+ <command>echo "Package versions:"; dpkg -l | cat</command>
</leafNode>
<leafNode name="frr">
<properties>
diff --git a/op-mode-definitions/show-zebra.xml.in b/op-mode-definitions/show-zebra.xml.in
new file mode 100644
index 000000000..b0ad37f49
--- /dev/null
+++ b/op-mode-definitions/show-zebra.xml.in
@@ -0,0 +1,54 @@
+<?xml version="1.0"?>
+<interfaceDefinition>
+ <node name="show">
+ <children>
+ <node name="zebra">
+ <properties>
+ <help>Zebra routing information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ <children>
+ <node name="client">
+ <properties>
+ <help>Client information </help>
+ </properties>
+ <children>
+ <node name="summary">
+ <properties>
+ <help>Brief Summary</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </node>
+ </children>
+ </node>
+ <node name="dplane">
+ <properties>
+ <help>Zebra dataplane information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </node>
+ <node name="router">
+ <properties>
+ <help>Zebra Router Information</help>
+ </properties>
+ <children>
+ <node name="table">
+ <properties>
+ <help>Table Information about this Zebra Router</help>
+ </properties>
+ <children>
+ <node name="summary">
+ <properties>
+ <help>Summary Information</help>
+ </properties>
+ <command>${vyos_op_scripts_dir}/vtysh_wrapper.sh $@</command>
+ </node>
+ </children>
+ </node>
+ </children>
+ </node>
+ </children>
+ </node>
+ </children>
+ </node>
+</interfaceDefinition>
diff --git a/python/vyos/configquery.py b/python/vyos/configquery.py
new file mode 100644
index 000000000..ed7346f1f
--- /dev/null
+++ b/python/vyos/configquery.py
@@ -0,0 +1,90 @@
+# Copyright 2021 VyOS maintainers and contributors <maintainers@vyos.io>
+#
+# This library is free software; you can redistribute it and/or
+# modify it under the terms of the GNU Lesser General Public
+# License as published by the Free Software Foundation; either
+# version 2.1 of the License, or (at your option) any later version.
+#
+# This library is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+# Lesser General Public License for more details.
+#
+# You should have received a copy of the GNU Lesser General Public License
+# along with this library. If not, see <http://www.gnu.org/licenses/>.
+
+'''
+A small library that allows querying existence or value(s) of config
+settings from op mode, and execution of arbitrary op mode commands.
+'''
+
+from subprocess import STDOUT
+from vyos.util import popen
+
+
+class ConfigQueryError(Exception):
+ pass
+
+class GenericConfigQuery:
+ def __init__(self):
+ pass
+
+ def exists(self, path: list):
+ raise NotImplementedError
+
+ def value(self, path: list):
+ raise NotImplementedError
+
+ def values(self, path: list):
+ raise NotImplementedError
+
+class GenericOpRun:
+ def __init__(self):
+ pass
+
+ def run(self, path: list, **kwargs):
+ raise NotImplementedError
+
+class CliShellApiConfigQuery(GenericConfigQuery):
+ def __init__(self):
+ super().__init__()
+
+ def exists(self, path: list):
+ cmd = ' '.join(path)
+ (_, err) = popen(f'cli-shell-api existsActive {cmd}')
+ if err:
+ return False
+ return True
+
+ def value(self, path: list):
+ cmd = ' '.join(path)
+ (out, err) = popen(f'cli-shell-api returnActiveValue {cmd}')
+ if err:
+ raise ConfigQueryError('No value for given path')
+ return out
+
+ def values(self, path: list):
+ cmd = ' '.join(path)
+ (out, err) = popen(f'cli-shell-api returnActiveValues {cmd}')
+ if err:
+ raise ConfigQueryError('No values for given path')
+ return out
+
+class VbashOpRun(GenericOpRun):
+ def __init__(self):
+ super().__init__()
+
+ def run(self, path: list, **kwargs):
+ cmd = ' '.join(path)
+ (out, err) = popen(f'. /opt/vyatta/share/vyatta-op/functions/interpreter/vyatta-op-run; _vyatta_op_run {cmd}', stderr=STDOUT, **kwargs)
+ if err:
+ raise ConfigQueryError(out)
+ return out
+
+def query_context(config_query_class=CliShellApiConfigQuery,
+ op_run_class=VbashOpRun):
+ query = config_query_class()
+ run = op_run_class()
+ return query, run
+
+
diff --git a/python/vyos/configverify.py b/python/vyos/configverify.py
index 7cf2cb8f9..718b7445d 100644
--- a/python/vyos/configverify.py
+++ b/python/vyos/configverify.py
@@ -80,7 +80,7 @@ def verify_vrf(config):
recurring validation of VRF configuration.
"""
from netifaces import interfaces
- if 'vrf' in config:
+ if 'vrf' in config and config['vrf'] != 'default':
if config['vrf'] not in interfaces():
raise ConfigError('VRF "{vrf}" does not exist'.format(**config))
diff --git a/python/vyos/frr.py b/python/vyos/frr.py
index 69c7a14ce..668489636 100644
--- a/python/vyos/frr.py
+++ b/python/vyos/frr.py
@@ -68,6 +68,7 @@ Apply the new configuration:
import tempfile
import re
from vyos import util
+from vyos.util import chown
import logging
from logging.handlers import SysLogHandler
import os
@@ -86,6 +87,7 @@ _frr_daemons = ['zebra', 'bgpd', 'fabricd', 'isisd', 'ospf6d', 'ospfd', 'pbrd',
path_vtysh = '/usr/bin/vtysh'
path_frr_reload = '/usr/lib/frr/frr-reload.py'
+path_config = '/run/frr'
class FrrError(Exception):
@@ -207,6 +209,30 @@ def reload_configuration(config, daemon=None):
return output
+def save_configuration(daemon=None):
+ """Save FRR configuration to /run/frr/{daemon}.conf
+ It save configuration on each commit.
+ """
+ if daemon and daemon not in _frr_daemons:
+ raise ValueError(f'The specified daemon type is not supported {repr(daemon)}')
+
+ cmd = f"{path_vtysh} -d {daemon} -c 'show run no-header'"
+ output, code = util.popen(cmd, stderr=util.STDOUT)
+ if code:
+ raise OSError(code, output)
+
+ daemon_conf = f'{path_config}/{daemon}.conf'
+
+ with open(daemon_conf, "w") as f:
+ f.write(output)
+ # Set permissions (frr:frr) for /run/frr/{daemon}.conf
+ if os.path.exists(daemon_conf):
+ chown(daemon_conf, 'frr', 'frr')
+ config = output
+
+ return config
+
+
def execute(command):
""" Run commands inside vtysh
command: str containing commands to execute inside a vtysh session
diff --git a/python/vyos/ifconfig/bridge.py b/python/vyos/ifconfig/bridge.py
index 600bd3db8..14f64a8de 100644
--- a/python/vyos/ifconfig/bridge.py
+++ b/python/vyos/ifconfig/bridge.py
@@ -312,9 +312,15 @@ class BridgeIf(Interface):
# not have any addresses configured by CLI so just flush any
# remaining ones
lower.flush_addrs()
+
# enslave interface port to bridge
self.add_port(interface)
+ # always set private-vlan/port isolation
+ tmp = dict_search('isolated', interface_config)
+ value = 'on' if (tmp != None) else 'off'
+ lower.set_port_isolation(value)
+
# set bridge port path cost
if 'cost' in interface_config:
value = interface_config.get('cost')
diff --git a/python/vyos/ifconfig/interface.py b/python/vyos/ifconfig/interface.py
index fe6a3c95e..ff05cab0e 100644
--- a/python/vyos/ifconfig/interface.py
+++ b/python/vyos/ifconfig/interface.py
@@ -113,6 +113,10 @@ class Interface(Control):
'convert': lambda name: name if name else '',
'shellcmd': 'ip link set dev {ifname} alias "{value}"',
},
+ 'bridge_port_isolation': {
+ 'validate': lambda v: assert_list(v, ['on', 'off']),
+ 'shellcmd': 'bridge link set dev {ifname} isolated {value}',
+ },
'mac': {
'validate': assert_mac,
'shellcmd': 'ip link set dev {ifname} address {value}',
@@ -689,6 +693,20 @@ class Interface(Control):
"""
self.set_interface('path_priority', priority)
+ def set_port_isolation(self, on_or_off):
+ """
+ Controls whether a given port will be isolated, which means it will be
+ able to communicate with non-isolated ports only. By default this flag
+ is off.
+
+ Use enable=1 to enable or enable=0 to disable
+
+ Example:
+ >>> from vyos.ifconfig import Interface
+ >>> Interface('eth1').set_port_isolation('on')
+ """
+ self.set_interface('bridge_port_isolation', on_or_off)
+
def set_proxy_arp(self, enable):
"""
Set per interface proxy ARP configuration
@@ -1051,6 +1069,10 @@ class Interface(Control):
if not isinstance(state, bool):
raise ValueError("Value out of range")
+ # https://phabricator.vyos.net/T3448 - there is (yet) no RPI support for XDP
+ if not os.path.exists('/usr/sbin/xdp_loader'):
+ return
+
ifname = self.config['ifname']
cmd = f'xdp_loader -d {ifname} -U --auto-mode'
if state:
@@ -1307,27 +1329,6 @@ class VLANIf(Interface):
""" Specific class which abstracts 802.1q and 802.1ad (Q-in-Q) VLAN interfaces """
iftype = 'vlan'
- def remove(self):
- """
- Remove interface from operating system. Removing the interface
- deconfigures all assigned IP addresses and clear possible DHCP(v6)
- client processes.
-
- Example:
- >>> from vyos.ifconfig import Interface
- >>> VLANIf('eth0.10').remove
- """
- # Do we have sub interfaces (VLANs)? As interfaces need to be deleted
- # "in order" starting from Q-in-Q we delete them first.
- for upper in glob(f'/sys/class/net/{self.ifname}/upper*'):
- # an upper interface could be named: upper_bond0.1000.1100, thus
- # we need top drop the upper_ prefix
- vif_c = os.path.basename(upper)
- vif_c = vif_c.replace('upper_', '')
- VLANIf(vif_c).remove()
-
- super().remove()
-
def _create(self):
# bail out early if interface already exists
if self.exists(f'{self.ifname}'):
diff --git a/python/vyos/util.py b/python/vyos/util.py
index 17a7dda91..e2f4b8fc4 100644
--- a/python/vyos/util.py
+++ b/python/vyos/util.py
@@ -630,23 +630,26 @@ def find_device_file(device):
return None
-def dict_search(path, dict):
- """ Traverse Python dictionary (dict) delimited by dot (.).
+def dict_search(path, my_dict):
+ """ Traverse Python dictionary (my_dict) delimited by dot (.).
Return value of key if found, None otherwise.
- This is faster implementation then jmespath.search('foo.bar', dict)"""
+ This is faster implementation then jmespath.search('foo.bar', my_dict)"""
+ if not isinstance(my_dict, dict) or not path:
+ return None
+
parts = path.split('.')
inside = parts[:-1]
if not inside:
- if path not in dict:
+ if path not in my_dict:
return None
- return dict[path]
- c = dict
+ return my_dict[path]
+ c = my_dict
for p in parts[:-1]:
c = c.get(p, {})
return c.get(parts[-1], None)
-def get_json_iface_options(interface):
+def get_interface_config(interface):
""" Returns the used encapsulation protocol for given interface.
If interface does not exist, None is returned.
"""
@@ -655,3 +658,16 @@ def get_json_iface_options(interface):
from json import loads
tmp = loads(cmd(f'ip -d -j link show {interface}'))[0]
return tmp
+
+def get_all_vrfs():
+ """ Return a dictionary of all system wide known VRF instances """
+ from json import loads
+ tmp = loads(cmd('ip -j vrf list'))
+ # Result is of type [{"name":"red","table":1000},{"name":"blue","table":2000}]
+ # so we will re-arrange it to a more nicer representation:
+ # {'red': {'table': 1000}, 'blue': {'table': 2000}}
+ data = {}
+ for entry in tmp:
+ name = entry.pop('name')
+ data[name] = entry
+ return data
diff --git a/scripts/override-default b/scripts/override-default
index d91b89426..c8a0ff1da 100755
--- a/scripts/override-default
+++ b/scripts/override-default
@@ -63,8 +63,7 @@ def override_element(l: list):
def collect_and_override(dir_name):
"""
Collect elements with defaultValue tag into dictionary indexed by tuple
- of (name, str(ancestor path)); the second component must be immutable for
- tuple to act as key, hence str().
+ of (name: str, ancestor path: str).
"""
for fname in glob.glob(f'{dir_name}/*.xml'):
tree = etree.parse(fname)
@@ -76,11 +75,13 @@ def collect_and_override(dir_name):
for element in xp:
ap = element.xpath('ancestor::*[@name]')
- defv.setdefault((ap[-1].get("name"), str(ap[:-1])), []).append(element)
+ ap_name = [el.get("name") for el in ap]
+ ap_path_str = ' '.join(ap_name[:-1])
+ defv.setdefault((ap_name[-1], ap_path_str), []).append(element)
for k, v in defv.items():
if len(v) > 1:
- logger.debug(f'overridding default in {k[0]}')
+ logger.info(f"overridding default in {k[0]}, path '{k[1]}'")
override_element(v)
revised_str = etree.tostring(root, encoding='unicode', pretty_print=True)
diff --git a/smoketest/configs/bgp-evpn-leaf b/smoketest/configs/bgp-evpn-leaf
new file mode 100644
index 000000000..73d658de8
--- /dev/null
+++ b/smoketest/configs/bgp-evpn-leaf
@@ -0,0 +1,148 @@
+interfaces {
+ bridge br100 {
+ member {
+ interface eth3 {
+ }
+ interface vxlan100 {
+ }
+ }
+ }
+ dummy dum0 {
+ address 172.29.0.1/32
+ }
+ ethernet eth0 {
+ description "Out-of-Band Managament Port"
+ address 2001:db8::41/64
+ address 192.0.2.41/27
+ vrf MGMT
+ }
+ ethernet eth1 {
+ address 172.29.1.1/31
+ mtu 1600
+ }
+ ethernet eth2 {
+ address 172.29.2.1/31
+ mtu 1600
+ }
+ ethernet eth3 {
+ }
+ loopback lo {
+ }
+ vxlan vxlan100 {
+ parameters {
+ nolearning
+ }
+ port 4789
+ source-address 172.29.0.1
+ vni 100
+ }
+}
+protocols {
+ bgp 65010 {
+ address-family {
+ ipv4-unicast {
+ maximum-paths {
+ ibgp 4
+ }
+ redistribute {
+ connected {
+ }
+ }
+ }
+ l2vpn-evpn {
+ advertise-all-vni
+ }
+ }
+ neighbor 172.29.1.0 {
+ peer-group evpn
+ }
+ neighbor 172.29.2.0 {
+ peer-group evpn
+ }
+ parameters {
+ log-neighbor-changes
+ }
+ peer-group evpn {
+ address-family {
+ ipv4-unicast {
+ nexthop-self {
+ }
+ }
+ l2vpn-evpn {
+ nexthop-self {
+ }
+ }
+ }
+ remote-as 65010
+ }
+ }
+ vrf MGMT {
+ static {
+ route 0.0.0.0/0 {
+ next-hop 192.0.2.62 {
+ }
+ }
+ route6 ::/0 {
+ next-hop 2001:db8::1 {
+ }
+ }
+ }
+ }
+}
+service {
+ lldp {
+ interface all {
+ }
+ }
+ ssh {
+ disable-host-validation
+ vrf MGMT
+ }
+}
+system {
+ config-management {
+ commit-revisions 100
+ }
+ console {
+ device ttyS0 {
+ speed 115200
+ }
+ }
+ host-name vyos
+ login {
+ user vyos {
+ authentication {
+ encrypted-password $6$O5gJRlDYQpj$MtrCV9lxMnZPMbcxlU7.FI793MImNHznxGoMFgm3Q6QP3vfKJyOSRCt3Ka/GzFQyW1yZS4NS616NLHaIPPFHc0
+ plaintext-password ""
+ }
+ }
+ }
+ ntp {
+ listen-address 192.0.2.41
+ listen-address 2001:db8::41
+ server 0.de.pool.ntp.org {
+ prefer
+ }
+ vrf MGMT
+ }
+ syslog {
+ global {
+ facility all {
+ level info
+ }
+ facility protocols {
+ level debug
+ }
+ }
+ }
+}
+vrf {
+ name MGMT {
+ table 1000
+ }
+}
+
+
+// Warning: Do not remove the following line.
+// vyos-config-version: "broadcast-relay@1:cluster@1:config-management@1:conntrack@2:conntrack-sync@1:dhcp-relay@2:dhcp-server@5:dhcpv6-server@1:dns-forwarding@3:firewall@5:https@2:interfaces@20:ipoe-server@1:ipsec@5:l2tp@3:lldp@1:mdns@1:nat@5:nat66@1:ntp@1:pppoe-server@5:pptp@2:qos@1:quagga@8:rpki@1:salt@1:snmp@2:ssh@2:sstp@3:system@20:vrrp@2:vyos-accel-ppp@2:wanloadbalance@3:webproxy@2:zone-policy@1"
+// Release version: 1.4-rolling-202103091038
diff --git a/smoketest/configs/bgp-evpn-spine b/smoketest/configs/bgp-evpn-spine
new file mode 100644
index 000000000..5dafc2f77
--- /dev/null
+++ b/smoketest/configs/bgp-evpn-spine
@@ -0,0 +1,128 @@
+interfaces {
+ ethernet eth0 {
+ description "Out-of-Band Managament Port"
+ address 192.0.2.51/27
+ address 2001:db8::51/64
+ vrf MGMT
+ }
+ ethernet eth1 {
+ address 172.29.1.0/31
+ mtu 1600
+ }
+ ethernet eth2 {
+ address 172.29.1.2/31
+ mtu 1600
+ }
+ ethernet eth3 {
+ address 172.29.1.4/31
+ mtu 1600
+ }
+ loopback lo {
+ }
+}
+protocols {
+ bgp 65010 {
+ address-family {
+ ipv4-unicast {
+ maximum-paths {
+ ibgp 4
+ }
+ redistribute {
+ connected {
+ }
+ }
+ }
+ }
+ listen {
+ range 172.29.1.0/24 {
+ peer-group evpn
+ }
+ }
+ parameters {
+ log-neighbor-changes
+ }
+ peer-group evpn {
+ address-family {
+ ipv4-unicast {
+ route-reflector-client
+ }
+ l2vpn-evpn {
+ route-reflector-client
+ }
+ }
+ capability {
+ dynamic
+ }
+ remote-as 65010
+ }
+ }
+ vrf MGMT {
+ static {
+ route 0.0.0.0/0 {
+ next-hop 192.0.2.62 {
+ }
+ }
+ route6 ::/0 {
+ next-hop 2001:db8::1 {
+ }
+ }
+ }
+ }
+}
+service {
+ lldp {
+ interface all {
+ }
+ }
+ ssh {
+ disable-host-validation
+ vrf MGMT
+ }
+}
+system {
+ config-management {
+ commit-revisions 100
+ }
+ console {
+ device ttyS0 {
+ speed 115200
+ }
+ }
+ host-name vyos
+ login {
+ user vyos {
+ authentication {
+ encrypted-password $6$O5gJRlDYQpj$MtrCV9lxMnZPMbcxlU7.FI793MImNHznxGoMFgm3Q6QP3vfKJyOSRCt3Ka/GzFQyW1yZS4NS616NLHaIPPFHc0
+ plaintext-password ""
+ }
+ }
+ }
+ ntp {
+ listen-address 192.0.2.51
+ listen-address 2001:db8::51
+ server 0.de.pool.ntp.org {
+ prefer
+ }
+ vrf MGMT
+ }
+ syslog {
+ global {
+ facility all {
+ level info
+ }
+ facility protocols {
+ level debug
+ }
+ }
+ }
+}
+vrf {
+ name MGMT {
+ table 1000
+ }
+}
+
+
+// Warning: Do not remove the following line.
+// vyos-config-version: "broadcast-relay@1:cluster@1:config-management@1:conntrack@2:conntrack-sync@1:dhcp-relay@2:dhcp-server@5:dhcpv6-server@1:dns-forwarding@3:firewall@5:https@2:interfaces@20:ipoe-server@1:ipsec@5:l2tp@3:lldp@1:mdns@1:nat@5:nat66@1:ntp@1:pppoe-server@5:pptp@2:qos@1:quagga@8:rpki@1:salt@1:snmp@2:ssh@2:sstp@3:system@20:vrrp@2:vyos-accel-ppp@2:wanloadbalance@3:webproxy@2:zone-policy@1"
+// Release version: 1.4-rolling-202103091038
diff --git a/smoketest/configs/isis-small b/smoketest/configs/isis-small
new file mode 100644
index 000000000..2c42ac9c4
--- /dev/null
+++ b/smoketest/configs/isis-small
@@ -0,0 +1,105 @@
+interfaces {
+ dummy dum0 {
+ address 203.0.113.1/24
+ }
+ ethernet eth0 {
+ duplex auto
+ speed auto
+ }
+ ethernet eth1 {
+ address 192.0.2.1/24
+ duplex auto
+ speed auto
+ }
+ ethernet eth2 {
+ duplex auto
+ speed auto
+ }
+ ethernet eth3 {
+ duplex auto
+ speed auto
+ }
+}
+policy {
+ prefix-list EXPORT-ISIS {
+ rule 10 {
+ action permit
+ prefix 203.0.113.0/24
+ }
+ }
+ route-map EXPORT-ISIS {
+ rule 10 {
+ action permit
+ match {
+ ip {
+ address {
+ prefix-list EXPORT-ISIS
+ }
+ }
+ }
+ }
+ }
+}
+protocols {
+ isis FOO {
+ interface eth1 {
+ bfd
+ }
+ net 49.0001.1921.6800.1002.00
+ redistribute {
+ ipv4 {
+ connected {
+ level-2 {
+ route-map EXPORT-ISIS
+ }
+ }
+ }
+ }
+ }
+}
+system {
+ config-management {
+ commit-revisions 200
+ }
+ console {
+ device ttyS0 {
+ speed 115200
+ }
+ }
+ domain-name vyos.io
+ host-name vyos
+ login {
+ user vyos {
+ authentication {
+ encrypted-password $6$2Ta6TWHd/U$NmrX0x9kexCimeOcYK1MfhMpITF9ELxHcaBU/znBq.X2ukQOj61fVI2UYP/xBzP4QtiTcdkgs7WOQMHWsRymO/
+ plaintext-password ""
+ }
+ level admin
+ }
+ }
+ ntp {
+ server 0.pool.ntp.org {
+ }
+ server 1.pool.ntp.org {
+ }
+ server 2.pool.ntp.org {
+ }
+ }
+ syslog {
+ global {
+ facility all {
+ level info
+ }
+ facility protocols {
+ level debug
+ }
+ }
+ }
+ time-zone Europe/Berlin
+}
+
+
+// Warning: Do not remove the following line.
+// vyos-config-version: "broadcast-relay@1:cluster@1:config-management@1:conntrack@1:conntrack-sync@1:dhcp-relay@2:dhcp-server@5:dhcpv6-server@1:dns-forwarding@3:firewall@5:https@2:interfaces@18:ipoe-server@1:ipsec@5:l2tp@3:lldp@1:mdns@1:nat@5:ntp@1:pppoe-server@5:pptp@2:qos@1:quagga@7:rpki@1:salt@1:snmp@2:ssh@2:sstp@3:system@20:vrrp@2:vyos-accel-ppp@2:wanloadbalance@3:webproxy@2:zone-policy@1"
+// Release version: 1.3.0-rc1
+
diff --git a/smoketest/configs/vrf-bgp b/smoketest/configs/vrf-bgp
new file mode 100644
index 000000000..4ad372a36
--- /dev/null
+++ b/smoketest/configs/vrf-bgp
@@ -0,0 +1,166 @@
+interfaces {
+ ethernet eth0 {
+ address 192.0.2.1/24
+ }
+ ethernet eth1 {
+ vrf black
+ }
+ ethernet eth2 {
+ vrf black
+ }
+}
+protocols {
+ ospf {
+ area 0 {
+ network 192.0.2.0/24
+ }
+ interface eth0 {
+ authentication {
+ md5 {
+ key-id 10 {
+ md5-key ospfkey
+ }
+ }
+ }
+ }
+ log-adjacency-changes {
+ }
+ parameters {
+ abr-type cisco
+ router-id 1.2.3.4
+ }
+ passive-interface default
+ passive-interface-exclude eth0
+ }
+}
+system {
+ config-management {
+ commit-revisions 100
+ }
+ console {
+ device ttyS0 {
+ speed 115200
+ }
+ }
+ host-name vyos
+ login {
+ user vyos {
+ authentication {
+ encrypted-password $6$O5gJRlDYQpj$MtrCV9lxMnZPMbcxlU7.FI793MImNHznxGoMFgm3Q6QP3vfKJyOSRCt3Ka/GzFQyW1yZS4NS616NLHaIPPFHc0
+ plaintext-password ""
+ }
+ }
+ }
+ nt
+ ntp {
+ server 0.pool.ntp.org {
+ }
+ server 1.pool.ntp.org {
+ }
+ server 2.pool.ntp.org {
+ }
+ }
+ syslog {
+ global {
+ facility all {
+ level info
+ }
+ facility protocols {
+ level debug
+ }
+ }
+ }
+ time-zone Europe/Berlin
+}
+vrf {
+ name black {
+ protocols {
+ bgp 65000 {
+ address-family {
+ ipv4-unicast {
+ network 10.0.150.0/23 {
+ }
+ }
+ ipv6-unicast {
+ network 2001:db8:200::/40 {
+ }
+ }
+ }
+ neighbor 10.0.151.222 {
+ disable-send-community {
+ extended
+ standard
+ }
+ address-family {
+ ipv4-unicast {
+ default-originate {
+ }
+ soft-reconfiguration {
+ inbound
+ }
+ }
+ }
+ capability {
+ dynamic
+ }
+ remote-as 65010
+ }
+ neighbor 10.0.151.252 {
+ peer-group VYOSv4
+ }
+ neighbor 10.0.151.254 {
+ peer-group VYOSv4
+ }
+ neighbor 2001:db8:200:ffff::3 {
+ peer-group VYOSv6
+ }
+ neighbor 2001:db8:200:ffff::a {
+ peer-group VYOSv6
+ }
+ neighbor 2001:db8:200:ff::101:2 {
+ remote-as 65010
+ }
+ parameters {
+ default {
+ no-ipv4-unicast
+ }
+ log-neighbor-changes
+ router-id 10.0.151.251
+ }
+ peer-group VYOSv4 {
+ address-family {
+ ipv4-unicast {
+ nexthop-self {
+ }
+ }
+ }
+ capability {
+ dynamic
+ }
+ remote-as 65000
+ update-source dum0
+ }
+ peer-group VYOSv6 {
+ address-family {
+ ipv6-unicast {
+ nexthop-self {
+ }
+ }
+ }
+ capability {
+ dynamic
+ }
+ remote-as 65000
+ update-source dum0
+ }
+ }
+
+ }
+ table 2000
+ }
+}
+
+
+// Warning: Do not remove the following line.
+// vyos-config-version: "broadcast-relay@1:cluster@1:config-management@1:conntrack@2:conntrack-sync@1:dhcp-relay@2:dhcp-server@5:dhcpv6-server@1:dns-forwarding@3:firewall@5:https@2:interfaces@20:ipoe-server@1:ipsec@5:l2tp@3:lldp@1:mdns@1:nat@5:nat66@1:ntp@1:pppoe-server@5:pptp@2:qos@1:quagga@9:rpki@1:salt@1:snmp@2:ssh@2:sstp@3:system@20:vrf@2:vrrp@2:vyos-accel-ppp@2:wanloadbalance@3:webproxy@2:zone-policy@1"
+// Release version: 1.4-rolling-202103130218
diff --git a/smoketest/configs/vrf-ospf b/smoketest/configs/vrf-ospf
new file mode 100644
index 000000000..7855e86bf
--- /dev/null
+++ b/smoketest/configs/vrf-ospf
@@ -0,0 +1,145 @@
+interfaces {
+ ethernet eth0 {
+ address 192.0.2.1/24
+ }
+ ethernet eth1 {
+ vrf red
+ }
+ ethernet eth2 {
+ vrf blue
+ }
+}
+protocols {
+ ospf {
+ area 0 {
+ network 192.0.2.0/24
+ }
+ interface eth0 {
+ authentication {
+ md5 {
+ key-id 10 {
+ md5-key ospfkey
+ }
+ }
+ }
+ }
+ log-adjacency-changes {
+ }
+ parameters {
+ abr-type cisco
+ router-id 1.2.3.4
+ }
+ passive-interface default
+ passive-interface-exclude eth0
+ }
+}
+system {
+ config-management {
+ commit-revisions 100
+ }
+ console {
+ device ttyS0 {
+ speed 115200
+ }
+ }
+ host-name vyos
+ login {
+ user vyos {
+ authentication {
+ encrypted-password $6$O5gJRlDYQpj$MtrCV9lxMnZPMbcxlU7.FI793MImNHznxGoMFgm3Q6QP3vfKJyOSRCt3Ka/GzFQyW1yZS4NS616NLHaIPPFHc0
+ plaintext-password ""
+ }
+ }
+ }
+ nt
+ ntp {
+ server 0.pool.ntp.org {
+ }
+ server 1.pool.ntp.org {
+ }
+ server 2.pool.ntp.org {
+ }
+ }
+ syslog {
+ global {
+ facility all {
+ level info
+ }
+ facility protocols {
+ level debug
+ }
+ }
+ }
+ time-zone Europe/Berlin
+}
+vrf {
+ name blue {
+ protocols {
+ ospf {
+ area 0 {
+ network 172.18.201.0/24
+ }
+ interface eth2 {
+ authentication {
+ md5 {
+ key-id 30 {
+ md5-key vyoskey456
+ }
+ }
+ }
+ dead-interval 40
+ hello-interval 10
+ priority 1
+ retransmit-interval 5
+ transmit-delay 1
+ }
+ log-adjacency-changes {
+ }
+ parameters {
+ abr-type cisco
+ router-id 5.6.7.8
+ }
+ passive-interface default
+ passive-interface-exclude eth2
+ }
+ }
+ table 2000
+ }
+ name red {
+ protocols {
+ ospf {
+ area 0 {
+ network 172.18.202.0/24
+ }
+ interface eth1 {
+ authentication {
+ md5 {
+ key-id 20 {
+ md5-key vyoskey123
+ }
+ }
+ }
+ dead-interval 40
+ hello-interval 10
+ priority 1
+ retransmit-interval 5
+ transmit-delay 1
+ }
+ log-adjacency-changes {
+ }
+ parameters {
+ abr-type cisco
+ router-id 9.10.11.12
+ }
+ passive-interface default
+ passive-interface-exclude eth1
+ }
+ }
+ table 1000
+ }
+}
+
+
+// Warning: Do not remove the following line.
+// vyos-config-version: "broadcast-relay@1:cluster@1:config-management@1:conntrack@2:conntrack-sync@1:dhcp-relay@2:dhcp-server@5:dhcpv6-server@1:dns-forwarding@3:firewall@5:https@2:interfaces@20:ipoe-server@1:ipsec@5:l2tp@3:lldp@1:mdns@1:nat@5:nat66@1:ntp@1:pppoe-server@5:pptp@2:qos@1:quagga@9:rpki@1:salt@1:snmp@2:ssh@2:sstp@3:system@20:vrf@2:vrrp@2:vyos-accel-ppp@2:wanloadbalance@3:webproxy@2:zone-policy@1"
+// Release version: 1.4-rolling-202103130218
diff --git a/smoketest/scripts/cli/base_accel_ppp_test.py b/smoketest/scripts/cli/base_accel_ppp_test.py
index 705c932b4..b2acb03cc 100644
--- a/smoketest/scripts/cli/base_accel_ppp_test.py
+++ b/smoketest/scripts/cli/base_accel_ppp_test.py
@@ -12,10 +12,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import re
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
from configparser import ConfigParser
from vyos.configsession import ConfigSession
@@ -26,26 +26,22 @@ from vyos.util import get_half_cpus
from vyos.util import process_named_running
class BasicAccelPPPTest:
- class BaseTest(unittest.TestCase):
-
+ class TestCase(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
self._gateway = '192.0.2.1'
-
# ensure we can also run this test on a live system - so lets clean
# out the current configuration :)
- self.session.delete(self._base_path)
+ self.cli_delete(self._base_path)
def tearDown(self):
- self.session.delete(self._base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(self._base_path)
+ self.cli_commit()
def set(self, path):
- self.session.set(self._base_path + path)
+ self.cli_set(self._base_path + path)
def delete(self, path):
- self.session.delete(self._base_path + path)
+ self.cli_delete(self._base_path + path)
def basic_config(self):
# PPPoE local auth mode requires local users to be configured!
@@ -65,7 +61,7 @@ class BasicAccelPPPTest:
self.set(['name-server', ns])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Validate configuration values
conf = ConfigParser(allow_no_value=True, delimiters='=')
@@ -95,11 +91,11 @@ class BasicAccelPPPTest:
# upload rate-limit requires also download rate-limit
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
self.set(['authentication', 'local-users', 'username', user, 'rate-limit', 'download', download])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Validate configuration values
conf = ConfigParser(allow_no_value=True, delimiters='=')
@@ -123,7 +119,7 @@ class BasicAccelPPPTest:
# Check local-users default value(s)
self.delete(['authentication', 'local-users', 'username', user, 'static-ip'])
# commit changes
- self.session.commit()
+ self.cli_commit()
# check local users
tmp = cmd(f'sudo cat {self._chap_secrets}')
@@ -162,7 +158,7 @@ class BasicAccelPPPTest:
self.set(['authentication', 'radius', 'source-address', source_address])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Validate configuration values
conf = ConfigParser(allow_no_value=True, delimiters='=')
@@ -200,7 +196,7 @@ class BasicAccelPPPTest:
self.set(['authentication', 'radius', 'server', radius_server, 'disable-accounting'])
# commit changes
- self.session.commit()
+ self.cli_commit()
conf.read(self._config_file)
diff --git a/smoketest/scripts/cli/base_interfaces_test.py b/smoketest/scripts/cli/base_interfaces_test.py
index d038e9cb8..f897088ef 100644
--- a/smoketest/scripts/cli/base_interfaces_test.py
+++ b/smoketest/scripts/cli/base_interfaces_test.py
@@ -22,6 +22,8 @@ from netifaces import AF_INET6
from netifaces import ifaddresses
from netifaces import interfaces
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.ifconfig import Interface
from vyos.ifconfig import Section
@@ -29,7 +31,7 @@ from vyos.util import read_file
from vyos.util import cmd
from vyos.util import dict_search
from vyos.util import process_named_running
-from vyos.util import get_json_iface_options
+from vyos.util import get_interface_config
from vyos.validate import is_intf_addr_assigned
from vyos.validate import is_ipv6_link_local
@@ -52,7 +54,7 @@ def is_mirrored_to(interface, mirror_if, qdisc):
return ret_val
class BasicInterfaceTest:
- class BaseTest(unittest.TestCase):
+ class TestCase(VyOSUnitTestSHIM.TestCase):
_test_ip = False
_test_mtu = False
_test_vlan = False
@@ -75,22 +77,19 @@ class BasicInterfaceTest:
_mtu = '1280'
def setUp(self):
- self.session = ConfigSession(os.getpid())
-
# Setup mirror interfaces for SPAN (Switch Port Analyzer)
for span in self._mirror_interfaces:
section = Section.section(span)
- self.session.set(['interfaces', section, span])
+ self.cli_set(['interfaces', section, span])
def tearDown(self):
# Tear down mirror interfaces for SPAN (Switch Port Analyzer)
for span in self._mirror_interfaces:
section = Section.section(span)
- self.session.delete(['interfaces', section, span])
+ self.cli_delete(['interfaces', section, span])
- self.session.delete(self._base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(self._base_path)
+ self.cli_commit()
# Verify that no previously interface remained on the system
for intf in self._interfaces:
@@ -103,10 +102,10 @@ class BasicInterfaceTest:
# Check the two-way mirror rules of ingress and egress
for mirror in self._mirror_interfaces:
for interface in self._interfaces:
- self.session.set(self._base_path + [interface, 'mirror', 'ingress', mirror])
- self.session.set(self._base_path + [interface, 'mirror', 'egress', mirror])
+ self.cli_set(self._base_path + [interface, 'mirror', 'ingress', mirror])
+ self.cli_set(self._base_path + [interface, 'mirror', 'egress', mirror])
- self.session.commit()
+ self.cli_commit()
# Verify config
for mirror in self._mirror_interfaces:
@@ -118,11 +117,11 @@ class BasicInterfaceTest:
# Check if description can be added to interface and
# can be read back
for intf in self._interfaces:
- self.session.set(self._base_path + [intf, 'disable'])
+ self.cli_set(self._base_path + [intf, 'disable'])
for option in self._options.get(intf, []):
- self.session.set(self._base_path + [intf] + option.split())
+ self.cli_set(self._base_path + [intf] + option.split())
- self.session.commit()
+ self.cli_commit()
# Validate interface description
for intf in self._interfaces:
@@ -133,11 +132,11 @@ class BasicInterfaceTest:
# can be read back
for intf in self._interfaces:
test_string=f'Description-Test-{intf}'
- self.session.set(self._base_path + [intf, 'description', test_string])
+ self.cli_set(self._base_path + [intf, 'description', test_string])
for option in self._options.get(intf, []):
- self.session.set(self._base_path + [intf] + option.split())
+ self.cli_set(self._base_path + [intf] + option.split())
- self.session.commit()
+ self.cli_commit()
# Validate interface description
for intf in self._interfaces:
@@ -145,9 +144,9 @@ class BasicInterfaceTest:
tmp = read_file(f'/sys/class/net/{intf}/ifalias')
self.assertEqual(tmp, test_string)
self.assertEqual(Interface(intf).get_alias(), test_string)
- self.session.delete(self._base_path + [intf, 'description'])
+ self.cli_delete(self._base_path + [intf, 'description'])
- self.session.commit()
+ self.cli_commit()
# Validate remove interface description "empty"
for intf in self._interfaces:
@@ -158,11 +157,11 @@ class BasicInterfaceTest:
def test_add_single_ip_address(self):
addr = '192.0.2.0/31'
for intf in self._interfaces:
- self.session.set(self._base_path + [intf, 'address', addr])
+ self.cli_set(self._base_path + [intf, 'address', addr])
for option in self._options.get(intf, []):
- self.session.set(self._base_path + [intf] + option.split())
+ self.cli_set(self._base_path + [intf] + option.split())
- self.session.commit()
+ self.cli_commit()
for intf in self._interfaces:
self.assertTrue(is_intf_addr_assigned(intf, addr))
@@ -172,11 +171,11 @@ class BasicInterfaceTest:
# Add address
for intf in self._interfaces:
for addr in self._test_addr:
- self.session.set(self._base_path + [intf, 'address', addr])
+ self.cli_set(self._base_path + [intf, 'address', addr])
for option in self._options.get(intf, []):
- self.session.set(self._base_path + [intf] + option.split())
+ self.cli_set(self._base_path + [intf] + option.split())
- self.session.commit()
+ self.cli_commit()
# Validate address
for intf in self._interfaces:
@@ -196,10 +195,10 @@ class BasicInterfaceTest:
for interface in self._interfaces:
base = self._base_path + [interface]
for option in self._options.get(interface, []):
- self.session.set(base + option.split())
+ self.cli_set(base + option.split())
# after commit we must have an IPv6 link-local address
- self.session.commit()
+ self.cli_commit()
for interface in self._interfaces:
for addr in ifaddresses(interface)[AF_INET6]:
@@ -208,10 +207,10 @@ class BasicInterfaceTest:
# disable IPv6 link-local address assignment
for interface in self._interfaces:
base = self._base_path + [interface]
- self.session.set(base + ['ipv6', 'address', 'no-default-link-local'])
+ self.cli_set(base + ['ipv6', 'address', 'no-default-link-local'])
# after commit we must have no IPv6 link-local address
- self.session.commit()
+ self.cli_commit()
for interface in self._interfaces:
self.assertTrue(AF_INET6 not in ifaddresses(interface))
@@ -222,12 +221,12 @@ class BasicInterfaceTest:
for intf in self._interfaces:
base = self._base_path + [intf]
- self.session.set(base + ['mtu', self._mtu])
+ self.cli_set(base + ['mtu', self._mtu])
for option in self._options.get(intf, []):
- self.session.set(base + option.split())
+ self.cli_set(base + option.split())
# commit interface changes
- self.session.commit()
+ self.cli_commit()
# verify changed MTU
for intf in self._interfaces:
@@ -245,14 +244,14 @@ class BasicInterfaceTest:
for intf in self._interfaces:
base = self._base_path + [intf]
- self.session.set(base + ['mtu', self._mtu])
- self.session.set(base + ['ipv6', 'address', 'no-default-link-local'])
+ self.cli_set(base + ['mtu', self._mtu])
+ self.cli_set(base + ['ipv6', 'address', 'no-default-link-local'])
for option in self._options.get(intf, []):
- self.session.set(base + option.split())
+ self.cli_set(base + option.split())
# commit interface changes
- self.session.commit()
+ self.cli_commit()
# verify changed MTU
for intf in self._interfaces:
@@ -272,15 +271,15 @@ class BasicInterfaceTest:
for interface in self._interfaces:
base = self._base_path + [interface]
for option in self._options.get(interface, []):
- self.session.set(base + option.split())
+ self.cli_set(base + option.split())
for vlan in self._vlan_range:
base = self._base_path + [interface, 'vif', vlan]
- self.session.set(base + ['mtu', self._mtu])
+ self.cli_set(base + ['mtu', self._mtu])
for address in self._test_addr:
- self.session.set(base + ['address', address])
+ self.cli_set(base + ['address', address])
- self.session.commit()
+ self.cli_commit()
for intf in self._interfaces:
for vlan in self._vlan_range:
@@ -300,24 +299,24 @@ class BasicInterfaceTest:
for interface in self._interfaces:
base = self._base_path + [interface]
for option in self._options.get(interface, []):
- self.session.set(base + option.split())
+ self.cli_set(base + option.split())
# disable the lower interface
- self.session.set(base + ['disable'])
+ self.cli_set(base + ['disable'])
for vlan in self._vlan_range:
vlan_base = self._base_path + [interface, 'vif', vlan]
# disable the vlan interface
- self.session.set(vlan_base + ['disable'])
+ self.cli_set(vlan_base + ['disable'])
- self.session.commit()
+ self.cli_commit()
# re-enable all lower interfaces
for interface in self._interfaces:
base = self._base_path + [interface]
- self.session.delete(base + ['disable'])
+ self.cli_delete(base + ['disable'])
- self.session.commit()
+ self.cli_commit()
# verify that the lower interfaces are admin up and the vlan
# interfaces are all admin down
@@ -340,20 +339,20 @@ class BasicInterfaceTest:
for interface in self._interfaces:
base = self._base_path + [interface]
for option in self._options.get(interface, []):
- self.session.set(base + option.split())
+ self.cli_set(base + option.split())
for vif_s in self._qinq_range:
for vif_c in self._vlan_range:
base = self._base_path + [interface, 'vif-s', vif_s, 'vif-c', vif_c]
- self.session.set(base + ['mtu', self._mtu])
+ self.cli_set(base + ['mtu', self._mtu])
for address in self._test_addr:
- self.session.set(base + ['address', address])
+ self.cli_set(base + ['address', address])
- self.session.commit()
+ self.cli_commit()
for interface in self._interfaces:
for vif_s in self._qinq_range:
- tmp = get_json_iface_options(f'{interface}.{vif_s}')
+ tmp = get_interface_config(f'{interface}.{vif_s}')
self.assertEqual(dict_search('linkinfo.info_data.protocol', tmp), '802.1ad')
for vif_c in self._vlan_range:
@@ -372,20 +371,20 @@ class BasicInterfaceTest:
arp_tmo = '300'
path = self._base_path + [interface]
for option in self._options.get(interface, []):
- self.session.set(path + option.split())
+ self.cli_set(path + option.split())
# Options
- self.session.set(path + ['ip', 'arp-cache-timeout', arp_tmo])
- self.session.set(path + ['ip', 'disable-arp-filter'])
- self.session.set(path + ['ip', 'disable-forwarding'])
- self.session.set(path + ['ip', 'enable-arp-accept'])
- self.session.set(path + ['ip', 'enable-arp-announce'])
- self.session.set(path + ['ip', 'enable-arp-ignore'])
- self.session.set(path + ['ip', 'enable-proxy-arp'])
- self.session.set(path + ['ip', 'proxy-arp-pvlan'])
- self.session.set(path + ['ip', 'source-validation', 'loose'])
-
- self.session.commit()
+ self.cli_set(path + ['ip', 'arp-cache-timeout', arp_tmo])
+ self.cli_set(path + ['ip', 'disable-arp-filter'])
+ self.cli_set(path + ['ip', 'disable-forwarding'])
+ self.cli_set(path + ['ip', 'enable-arp-accept'])
+ self.cli_set(path + ['ip', 'enable-arp-announce'])
+ self.cli_set(path + ['ip', 'enable-arp-ignore'])
+ self.cli_set(path + ['ip', 'enable-proxy-arp'])
+ self.cli_set(path + ['ip', 'proxy-arp-pvlan'])
+ self.cli_set(path + ['ip', 'source-validation', 'loose'])
+
+ self.cli_commit()
for interface in self._interfaces:
tmp = read_file(f'/proc/sys/net/ipv4/neigh/{interface}/base_reachable_time_ms')
@@ -423,13 +422,13 @@ class BasicInterfaceTest:
dad_transmits = '10'
path = self._base_path + [interface]
for option in self._options.get(interface, []):
- self.session.set(path + option.split())
+ self.cli_set(path + option.split())
# Options
- self.session.set(path + ['ipv6', 'disable-forwarding'])
- self.session.set(path + ['ipv6', 'dup-addr-detect-transmits', dad_transmits])
+ self.cli_set(path + ['ipv6', 'disable-forwarding'])
+ self.cli_set(path + ['ipv6', 'dup-addr-detect-transmits', dad_transmits])
- self.session.commit()
+ self.cli_commit()
for interface in self._interfaces:
tmp = read_file(f'/proc/sys/net/ipv6/conf/{interface}/forwarding')
@@ -447,16 +446,16 @@ class BasicInterfaceTest:
duid = '00:01:00:01:27:71:db:f0:00:50:00:00:00:{}'.format(duid_base)
path = self._base_path + [interface]
for option in self._options.get(interface, []):
- self.session.set(path + option.split())
+ self.cli_set(path + option.split())
# Enable DHCPv6 client
- self.session.set(path + ['address', 'dhcpv6'])
- self.session.set(path + ['dhcpv6-options', 'rapid-commit'])
- self.session.set(path + ['dhcpv6-options', 'parameters-only'])
- self.session.set(path + ['dhcpv6-options', 'duid', duid])
+ self.cli_set(path + ['address', 'dhcpv6'])
+ self.cli_set(path + ['dhcpv6-options', 'rapid-commit'])
+ self.cli_set(path + ['dhcpv6-options', 'parameters-only'])
+ self.cli_set(path + ['dhcpv6-options', 'duid', duid])
duid_base += 1
- self.session.commit()
+ self.cli_commit()
duid_base = 10
for interface in self._interfaces:
@@ -487,21 +486,21 @@ class BasicInterfaceTest:
for interface in self._interfaces:
path = self._base_path + [interface]
for option in self._options.get(interface, []):
- self.session.set(path + option.split())
+ self.cli_set(path + option.split())
address = '1'
# prefix delegation stuff
pd_base = path + ['dhcpv6-options', 'pd', '0']
- self.session.set(pd_base + ['length', prefix_len])
+ self.cli_set(pd_base + ['length', prefix_len])
for delegatee in delegatees:
section = Section.section(delegatee)
- self.session.set(['interfaces', section, delegatee])
- self.session.set(pd_base + ['interface', delegatee, 'address', address])
+ self.cli_set(['interfaces', section, delegatee])
+ self.cli_set(pd_base + ['interface', delegatee, 'address', address])
# increment interface address
address = str(int(address) + 1)
- self.session.commit()
+ self.cli_commit()
for interface in self._interfaces:
dhcpc6_config = read_file(f'/run/dhcp6c/dhcp6c.{interface}.conf')
@@ -529,7 +528,7 @@ class BasicInterfaceTest:
# we can already cleanup the test delegatee interface here
# as until commit() is called, nothing happens
section = Section.section(delegatee)
- self.session.delete(['interfaces', section, delegatee])
+ self.cli_delete(['interfaces', section, delegatee])
def test_dhcpv6pd_manual_sla_id(self):
if not self._test_ipv6_pd:
@@ -543,25 +542,25 @@ class BasicInterfaceTest:
for interface in self._interfaces:
path = self._base_path + [interface]
for option in self._options.get(interface, []):
- self.session.set(path + option.split())
+ self.cli_set(path + option.split())
# prefix delegation stuff
address = '1'
sla_id = '1'
pd_base = path + ['dhcpv6-options', 'pd', '0']
- self.session.set(pd_base + ['length', prefix_len])
+ self.cli_set(pd_base + ['length', prefix_len])
for delegatee in delegatees:
section = Section.section(delegatee)
- self.session.set(['interfaces', section, delegatee])
- self.session.set(pd_base + ['interface', delegatee, 'address', address])
- self.session.set(pd_base + ['interface', delegatee, 'sla-id', sla_id])
+ self.cli_set(['interfaces', section, delegatee])
+ self.cli_set(pd_base + ['interface', delegatee, 'address', address])
+ self.cli_set(pd_base + ['interface', delegatee, 'sla-id', sla_id])
# increment interface address
address = str(int(address) + 1)
sla_id = str(int(sla_id) + 1)
- self.session.commit()
+ self.cli_commit()
# Verify dhcpc6 client configuration
for interface in self._interfaces:
@@ -590,4 +589,4 @@ class BasicInterfaceTest:
# we can already cleanup the test delegatee interface here
# as until commit() is called, nothing happens
section = Section.section(delegatee)
- self.session.delete(['interfaces', section, delegatee])
+ self.cli_delete(['interfaces', section, delegatee])
diff --git a/smoketest/scripts/cli/base_vyostest_shim.py b/smoketest/scripts/cli/base_vyostest_shim.py
new file mode 100644
index 000000000..18e49f47f
--- /dev/null
+++ b/smoketest/scripts/cli/base_vyostest_shim.py
@@ -0,0 +1,90 @@
+# Copyright (C) 2021 VyOS maintainers and contributors
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or later as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import unittest
+
+from time import sleep
+
+from vyos.configsession import ConfigSession
+from vyos.configsession import ConfigSessionError
+from vyos import ConfigError
+from vyos.util import cmd
+
+save_config = '/tmp/vyos-smoketest-save'
+
+# This class acts as shim between individual Smoketests developed for VyOS and
+# the Python UnitTest framework. Before every test is loaded, we dump the current
+# system configuration and reload it after the test - despite the test results.
+#
+# Using this approach we can not render a live system useless while running any
+# kind of smoketest. In addition it adds debug capabilities like printing the
+# command used to execute the test.
+class VyOSUnitTestSHIM:
+ class TestCase(unittest.TestCase):
+ # if enabled in derived class, print out each and every set/del command
+ # on the CLI. This is usefull to grap all the commands required to
+ # trigger the certain failure condition.
+ # Use "self.debug = True" in derived classes setUp() method
+ debug = False
+
+ @classmethod
+ def setUpClass(cls):
+ cls._session = ConfigSession(os.getpid())
+ cls._session.save_config(save_config)
+ pass
+
+ @classmethod
+ def tearDownClass(cls):
+ # discard any pending changes which might caused a messed up config
+ cls._session.discard()
+ # ... and restore the initial state
+ cls._session.migrate_and_load_config(save_config)
+
+ try:
+ cls._session.commit()
+ except (ConfigError, ConfigSessionError):
+ cls._session.discard()
+ cls.fail(cls)
+
+ def cli_set(self, config):
+ if self.debug:
+ print('set ' + ' '.join(config))
+ self._session.set(config)
+
+ def cli_delete(self, config):
+ if self.debug:
+ print('del ' + ' '.join(config))
+ self._session.delete(config)
+
+ def cli_commit(self):
+ self._session.commit()
+
+ def getFRRconfig(self, string, end='$', endsection='^!'):
+ """ Retrieve current "running configuration" from FRR """
+ command = f'vtysh -c "show run" | sed -n "/^{string}{end}/,/{endsection}/p"'
+
+ count = 0
+ tmp = ''
+ while count < 10 and tmp == '':
+ # Let FRR settle after a config change first before harassing it again
+ sleep(1)
+ tmp = cmd(command)
+ count += 1
+
+ if self.debug or tmp == '':
+ import pprint
+ print(f'\n\ncommand "{command}" returned:\n')
+ pprint.pprint(tmp)
+ return tmp
diff --git a/smoketest/scripts/cli/test_interfaces_bonding.py b/smoketest/scripts/cli/test_interfaces_bonding.py
index b65d97d30..03cdafb8d 100755
--- a/smoketest/scripts/cli/test_interfaces_bonding.py
+++ b/smoketest/scripts/cli/test_interfaces_bonding.py
@@ -24,7 +24,7 @@ from vyos.ifconfig.interface import Interface
from vyos.configsession import ConfigSessionError
from vyos.util import read_file
-class BondingInterfaceTest(BasicInterfaceTest.BaseTest):
+class BondingInterfaceTest(BasicInterfaceTest.TestCase):
@classmethod
def setUpClass(cls):
cls._test_ip = True
@@ -52,6 +52,9 @@ class BondingInterfaceTest(BasicInterfaceTest.BaseTest):
for member in cls._members:
cls._options['bond0'].append(f'member interface {member}')
+ # call base-classes classmethod
+ super(cls, cls).setUpClass()
+
def test_add_single_ip_address(self):
super().test_add_single_ip_address()
@@ -74,16 +77,16 @@ class BondingInterfaceTest(BasicInterfaceTest.BaseTest):
# configure member interfaces
for interface in self._interfaces:
for option in self._options.get(interface, []):
- self.session.set(self._base_path + [interface] + option.split())
+ self.cli_set(self._base_path + [interface] + option.split())
- self.session.commit()
+ self.cli_commit()
# remove single bond member port
for interface in self._interfaces:
remove_member = self._members[0]
- self.session.delete(self._base_path + [interface, 'member', 'interface', remove_member])
+ self.cli_delete(self._base_path + [interface, 'member', 'interface', remove_member])
- self.session.commit()
+ self.cli_commit()
# removed member port must be admin-up
for interface in self._interfaces:
diff --git a/smoketest/scripts/cli/test_interfaces_bridge.py b/smoketest/scripts/cli/test_interfaces_bridge.py
index 7e10f12c4..21f20c781 100755
--- a/smoketest/scripts/cli/test_interfaces_bridge.py
+++ b/smoketest/scripts/cli/test_interfaces_bridge.py
@@ -25,9 +25,10 @@ from netifaces import interfaces
from vyos.ifconfig import Section
from vyos.util import cmd
from vyos.util import read_file
+from vyos.util import get_interface_config
from vyos.validate import is_intf_addr_assigned
-class BridgeInterfaceTest(BasicInterfaceTest.BaseTest):
+class BridgeInterfaceTest(BasicInterfaceTest.TestCase):
@classmethod
def setUpClass(cls):
cls._test_ip = True
@@ -53,68 +54,97 @@ class BridgeInterfaceTest(BasicInterfaceTest.BaseTest):
cls._options['br0'].append(f'member interface {member}')
cls._interfaces = list(cls._options)
+ # call base-classes classmethod
+ super(cls, cls).setUpClass()
+
def tearDown(self):
for intf in self._interfaces:
- self.session.delete(self._base_path + [intf])
+ self.cli_delete(self._base_path + [intf])
super().tearDown()
+ def test_isolated_interfaces(self):
+ # Add member interfaces to bridge and set STP cost/priority
+ for interface in self._interfaces:
+ base = self._base_path + [interface]
+ self.cli_set(base + ['stp'])
+
+ # assign members to bridge interface
+ for member in self._members:
+ base_member = base + ['member', 'interface', member]
+ self.cli_set(base_member + ['isolated'])
+
+ # commit config
+ self.cli_commit()
+
+ for interface in self._interfaces:
+ tmp = get_interface_config(interface)
+ # STP must be enabled as configured above
+ self.assertEqual(1, tmp['linkinfo']['info_data']['stp_state'])
+
+ # validate member interface configuration
+ for member in self._members:
+ tmp = get_interface_config(member)
+ # Isolated must be enabled as configured above
+ self.assertTrue(tmp['linkinfo']['info_slave_data']['isolated'])
+
+
def test_add_remove_bridge_member(self):
# Add member interfaces to bridge and set STP cost/priority
for interface in self._interfaces:
base = self._base_path + [interface]
- self.session.set(base + ['stp'])
- self.session.set(base + ['address', '192.0.2.1/24'])
+ self.cli_set(base + ['stp'])
+ self.cli_set(base + ['address', '192.0.2.1/24'])
cost = 1000
priority = 10
# assign members to bridge interface
for member in self._members:
base_member = base + ['member', 'interface', member]
- self.session.set(base_member + ['cost', str(cost)])
- self.session.set(base_member + ['priority', str(priority)])
+ self.cli_set(base_member + ['cost', str(cost)])
+ self.cli_set(base_member + ['priority', str(priority)])
cost += 1
priority += 1
# commit config
- self.session.commit()
-
- # check member interfaces are added on the bridge
- bridge_members = []
- for tmp in glob(f'/sys/class/net/{interface}/lower_*'):
- bridge_members.append(os.path.basename(tmp).replace('lower_', ''))
-
- for member in self._members:
- self.assertIn(member, bridge_members)
+ self.cli_commit()
- # delete all members
+ # Add member interfaces to bridge and set STP cost/priority
for interface in self._interfaces:
- self.session.delete(self._base_path + [interface, 'member'])
+ cost = 1000
+ priority = 10
+ for member in self._members:
+ tmp = get_interface_config(member)
+ self.assertEqual(interface, tmp['master'])
+ self.assertFalse( tmp['linkinfo']['info_slave_data']['isolated'])
+ self.assertEqual(cost, tmp['linkinfo']['info_slave_data']['cost'])
+ self.assertEqual(priority, tmp['linkinfo']['info_slave_data']['priority'])
+
+ cost += 1
+ priority += 1
- self.session.commit()
def test_vif_8021q_interfaces(self):
for interface in self._interfaces:
base = self._base_path + [interface]
- self.session.set(base + ['enable-vlan'])
+ self.cli_set(base + ['enable-vlan'])
super().test_vif_8021q_interfaces()
def test_vif_8021q_lower_up_down(self):
for interface in self._interfaces:
base = self._base_path + [interface]
- self.session.set(base + ['enable-vlan'])
+ self.cli_set(base + ['enable-vlan'])
super().test_vif_8021q_interfaces()
def test_bridge_vlan_filter(self):
-
vif_vlan = 2
# Add member interface to bridge and set VLAN filter
for interface in self._interfaces:
base = self._base_path + [interface]
- self.session.set(base + ['enable-vlan'])
- self.session.set(base + ['address', '192.0.2.1/24'])
- self.session.set(base + ['vif', str(vif_vlan), 'address', '192.0.3.1/24'])
- self.session.set(base + ['vif', str(vif_vlan), 'mtu', self._mtu])
+ self.cli_set(base + ['enable-vlan'])
+ self.cli_set(base + ['address', '192.0.2.1/24'])
+ self.cli_set(base + ['vif', str(vif_vlan), 'address', '192.0.3.1/24'])
+ self.cli_set(base + ['vif', str(vif_vlan), 'mtu', self._mtu])
vlan_id = 101
allowed_vlan = 2
@@ -122,13 +152,13 @@ class BridgeInterfaceTest(BasicInterfaceTest.BaseTest):
# assign members to bridge interface
for member in self._members:
base_member = base + ['member', 'interface', member]
- self.session.set(base_member + ['allowed-vlan', str(allowed_vlan)])
- self.session.set(base_member + ['allowed-vlan', allowed_vlan_range])
- self.session.set(base_member + ['native-vlan', str(vlan_id)])
+ self.cli_set(base_member + ['allowed-vlan', str(allowed_vlan)])
+ self.cli_set(base_member + ['allowed-vlan', allowed_vlan_range])
+ self.cli_set(base_member + ['native-vlan', str(vlan_id)])
vlan_id += 1
# commit config
- self.session.commit()
+ self.cli_commit()
# Detect the vlan filter function
for interface in self._interfaces:
@@ -184,7 +214,7 @@ class BridgeInterfaceTest(BasicInterfaceTest.BaseTest):
# delete all members
for interface in self._interfaces:
- self.session.delete(self._base_path + [interface, 'member'])
+ self.cli_delete(self._base_path + [interface, 'member'])
def test_bridge_vlan_members(self):
@@ -193,10 +223,10 @@ class BridgeInterfaceTest(BasicInterfaceTest.BaseTest):
for interface in self._interfaces:
for member in self._members:
for vif in vifs:
- self.session.set(['interfaces', 'ethernet', member, 'vif', vif])
- self.session.set(['interfaces', 'bridge', interface, 'member', 'interface', f'{member}.{vif}'])
+ self.cli_set(['interfaces', 'ethernet', member, 'vif', vif])
+ self.cli_set(['interfaces', 'bridge', interface, 'member', 'interface', f'{member}.{vif}'])
- self.session.commit()
+ self.cli_commit()
# Verify config
for interface in self._interfaces:
@@ -209,9 +239,8 @@ class BridgeInterfaceTest(BasicInterfaceTest.BaseTest):
for interface in self._interfaces:
for member in self._members:
for vif in vifs:
- self.session.delete(['interfaces', 'ethernet', member, 'vif', vif])
- self.session.delete(['interfaces', 'bridge', interface, 'member', 'interface', f'{member}.{vif}'])
+ self.cli_delete(['interfaces', 'ethernet', member, 'vif', vif])
+ self.cli_delete(['interfaces', 'bridge', interface, 'member', 'interface', f'{member}.{vif}'])
if __name__ == '__main__':
unittest.main(verbosity=2)
-
diff --git a/smoketest/scripts/cli/test_interfaces_dummy.py b/smoketest/scripts/cli/test_interfaces_dummy.py
index 6e462bccf..dedc6fe05 100755
--- a/smoketest/scripts/cli/test_interfaces_dummy.py
+++ b/smoketest/scripts/cli/test_interfaces_dummy.py
@@ -18,11 +18,13 @@ import unittest
from base_interfaces_test import BasicInterfaceTest
-class DummyInterfaceTest(BasicInterfaceTest.BaseTest):
+class DummyInterfaceTest(BasicInterfaceTest.TestCase):
@classmethod
def setUpClass(cls):
cls._base_path = ['interfaces', 'dummy']
cls._interfaces = ['dum435', 'dum8677', 'dum0931', 'dum089']
+ # call base-classes classmethod
+ super(cls, cls).setUpClass()
if __name__ == '__main__':
unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_interfaces_erspan.py b/smoketest/scripts/cli/test_interfaces_erspan.py
deleted file mode 100755
index cbb41d0c9..000000000
--- a/smoketest/scripts/cli/test_interfaces_erspan.py
+++ /dev/null
@@ -1,85 +0,0 @@
-#!/usr/bin/env python3
-#
-# Copyright (C) 2020-2021 VyOS maintainers and contributors
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 or later as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-import unittest
-
-from vyos.configsession import ConfigSession
-from vyos.configsession import ConfigSessionError
-from vyos.util import get_json_iface_options
-
-from base_interfaces_test import BasicInterfaceTest
-
-mtu = 1500
-
-class ERSPanTunnelInterfaceTest(BasicInterfaceTest.BaseTest):
- def setUp(self):
- super().setUp()
-
- self._base_path = ['interfaces', 'erspan']
- self._test_mtu = True
-
- self.local_v4 = '10.1.1.1'
- self.local_v6 = '2001:db8::1'
- self.remote_v4 = '10.2.2.2'
- self.remote_v6 = '2001:db9::1'
-
- def tearDown(self):
- self.session.delete(['interfaces', 'erspan'])
- super().tearDown()
-
- def test_erspan_ipv4(self):
- interface = 'ersp100'
- encapsulation = 'erspan'
- key = 123
-
- self.session.set(self._base_path + [interface, 'encapsulation', encapsulation])
- self.session.set(self._base_path + [interface, 'source-address', self.local_v4])
- self.session.set(self._base_path + [interface, 'remote', self.remote_v4])
- self.session.set(self._base_path + [interface, 'parameters', 'ip' , 'key', str(key)])
-
- self.session.commit()
-
- conf = get_json_iface_options(interface)
- self.assertEqual(interface, conf['ifname'])
- self.assertEqual(encapsulation, conf['linkinfo']['info_kind'])
- self.assertEqual(mtu, conf['mtu'])
-
- self.assertEqual(self.local_v4, conf['linkinfo']['info_data']['local'])
- self.assertEqual(self.remote_v4, conf['linkinfo']['info_data']['remote'])
-
-
- def test_erspan_ipv6(self):
- interface = 'ersp1000'
- encapsulation = 'ip6erspan'
- key = 123
-
- self.session.set(self._base_path + [interface, 'encapsulation', encapsulation])
- self.session.set(self._base_path + [interface, 'source-address', self.local_v6])
- self.session.set(self._base_path + [interface, 'remote', self.remote_v6])
- self.session.set(self._base_path + [interface, 'parameters', 'ip' , 'key', str(key)])
-
- self.session.commit()
-
- conf = get_json_iface_options(interface)
- self.assertEqual(interface, conf['ifname'])
- self.assertEqual(encapsulation, conf['linkinfo']['info_kind'])
- self.assertEqual(mtu, conf['mtu'])
-
- self.assertEqual(self.local_v6, conf['linkinfo']['info_data']['local'])
- self.assertEqual(self.remote_v6, conf['linkinfo']['info_data']['remote'])
-
-if __name__ == '__main__':
- unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_interfaces_ethernet.py b/smoketest/scripts/cli/test_interfaces_ethernet.py
index 772ff248f..cb0c8a426 100755
--- a/smoketest/scripts/cli/test_interfaces_ethernet.py
+++ b/smoketest/scripts/cli/test_interfaces_ethernet.py
@@ -34,7 +34,7 @@ def get_wpa_supplicant_value(interface, key):
tmp = re.findall(r'\n?{}=(.*)'.format(key), tmp)
return tmp[0]
-class EthernetInterfaceTest(BasicInterfaceTest.BaseTest):
+class EthernetInterfaceTest(BasicInterfaceTest.TestCase):
@classmethod
def setUpClass(cls):
cls._test_ip = True
@@ -61,37 +61,39 @@ class EthernetInterfaceTest(BasicInterfaceTest.BaseTest):
for interface in cls._interfaces:
cls._macs[interface] = read_file(f'/sys/class/net/{interface}/address')
+ # call base-classes classmethod
+ super(cls, cls).setUpClass()
+
def tearDown(self):
for interface in self._interfaces:
# when using a dedicated interface to test via TEST_ETH environment
# variable only this one will be cleared in the end - usable to test
# ethernet interfaces via SSH
- self.session.delete(self._base_path + [interface])
- self.session.set(self._base_path + [interface, 'duplex', 'auto'])
- self.session.set(self._base_path + [interface, 'speed', 'auto'])
- self.session.set(self._base_path + [interface, 'hw-id', self._macs[interface]])
+ self.cli_delete(self._base_path + [interface])
+ self.cli_set(self._base_path + [interface, 'duplex', 'auto'])
+ self.cli_set(self._base_path + [interface, 'speed', 'auto'])
+ self.cli_set(self._base_path + [interface, 'hw-id', self._macs[interface]])
# Tear down mirror interfaces for SPAN (Switch Port Analyzer)
for span in self._mirror_interfaces:
section = Section.section(span)
- self.session.delete(['interfaces', section, span])
+ self.cli_delete(['interfaces', section, span])
- self.session.commit()
- del self.session
+ self.cli_commit()
def test_dhcp_disable_interface(self):
# When interface is configured as admin down, it must be admin down
# even when dhcpc starts on the given interface
for interface in self._interfaces:
- self.session.set(self._base_path + [interface, 'disable'])
+ self.cli_set(self._base_path + [interface, 'disable'])
# Also enable DHCP (ISC DHCP always places interface in admin up
# state so we check that we do not start DHCP client.
# https://phabricator.vyos.net/T2767
- self.session.set(self._base_path + [interface, 'address', 'dhcp'])
+ self.cli_set(self._base_path + [interface, 'address', 'dhcp'])
- self.session.commit()
+ self.cli_commit()
# Validate interface state
for interface in self._interfaces:
@@ -111,9 +113,9 @@ class EthernetInterfaceTest(BasicInterfaceTest.BaseTest):
rps_cpus &= ~1
for interface in self._interfaces:
- self.session.set(self._base_path + [interface, 'offload', 'rps'])
+ self.cli_set(self._base_path + [interface, 'offload', 'rps'])
- self.session.commit()
+ self.cli_commit()
for interface in self._interfaces:
cpus = read_file('/sys/class/net/eth1/queues/rx-0/rps_cpus')
@@ -125,35 +127,35 @@ class EthernetInterfaceTest(BasicInterfaceTest.BaseTest):
def test_non_existing_interface(self):
unknonw_interface = self._base_path + ['eth667']
- self.session.set(unknonw_interface)
+ self.cli_set(unknonw_interface)
# check validate() - interface does not exist
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
# we need to remove this wrong interface from the configuration
# manually, else tearDown() will have problem in commit()
- self.session.delete(unknonw_interface)
+ self.cli_delete(unknonw_interface)
def test_speed_duplex_verify(self):
for interface in self._interfaces:
- self.session.set(self._base_path + [interface, 'speed', '1000'])
+ self.cli_set(self._base_path + [interface, 'speed', '1000'])
# check validate() - if either speed or duplex is not auto, the
# other one must be manually configured, too
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(self._base_path + [interface, 'speed', 'auto'])
- self.session.commit()
+ self.cli_commit()
+ self.cli_set(self._base_path + [interface, 'speed', 'auto'])
+ self.cli_commit()
def test_eapol_support(self):
for interface in self._interfaces:
# Enable EAPoL
- self.session.set(self._base_path + [interface, 'eapol', 'ca-cert-file', ca_cert])
- self.session.set(self._base_path + [interface, 'eapol', 'cert-file', ssl_cert])
- self.session.set(self._base_path + [interface, 'eapol', 'key-file', ssl_key])
+ self.cli_set(self._base_path + [interface, 'eapol', 'ca-cert-file', ca_cert])
+ self.cli_set(self._base_path + [interface, 'eapol', 'cert-file', ssl_cert])
+ self.cli_set(self._base_path + [interface, 'eapol', 'key-file', ssl_key])
- self.session.commit()
+ self.cli_commit()
# Check for running process
self.assertTrue(process_named_running('wpa_supplicant'))
diff --git a/smoketest/scripts/cli/test_interfaces_geneve.py b/smoketest/scripts/cli/test_interfaces_geneve.py
index 7edd4528e..129ee71e5 100755
--- a/smoketest/scripts/cli/test_interfaces_geneve.py
+++ b/smoketest/scripts/cli/test_interfaces_geneve.py
@@ -18,11 +18,11 @@ import unittest
from vyos.configsession import ConfigSession
from vyos.ifconfig import Interface
-from vyos.util import get_json_iface_options
+from vyos.util import get_interface_config
from base_interfaces_test import BasicInterfaceTest
-class GeneveInterfaceTest(BasicInterfaceTest.BaseTest):
+class GeneveInterfaceTest(BasicInterfaceTest.TestCase):
@classmethod
def setUpClass(cls):
cls._test_ip = True
@@ -34,24 +34,26 @@ class GeneveInterfaceTest(BasicInterfaceTest.BaseTest):
'gnv1': ['vni 30', 'remote 2001:db8::1', 'parameters ipv6 flowlabel 0x1000'],
}
cls._interfaces = list(cls._options)
+ # call base-classes classmethod
+ super(cls, cls).setUpClass()
def test_geneve_parameters(self):
tos = '40'
ttl = 20
for intf in self._interfaces:
for option in self._options.get(intf, []):
- self.session.set(self._base_path + [intf] + option.split())
+ self.cli_set(self._base_path + [intf] + option.split())
- self.session.set(self._base_path + [intf, 'parameters', 'ip', 'dont-fragment'])
- self.session.set(self._base_path + [intf, 'parameters', 'ip', 'tos', tos])
- self.session.set(self._base_path + [intf, 'parameters', 'ip', 'ttl', str(ttl)])
+ self.cli_set(self._base_path + [intf, 'parameters', 'ip', 'dont-fragment'])
+ self.cli_set(self._base_path + [intf, 'parameters', 'ip', 'tos', tos])
+ self.cli_set(self._base_path + [intf, 'parameters', 'ip', 'ttl', str(ttl)])
ttl += 10
- self.session.commit()
+ self.cli_commit()
ttl = 20
for interface in self._interfaces:
- options = get_json_iface_options(interface)
+ options = get_interface_config(interface)
vni = options['linkinfo']['info_data']['id']
self.assertIn(f'vni {vni}', self._options[interface])
diff --git a/smoketest/scripts/cli/test_interfaces_l2tpv3.py b/smoketest/scripts/cli/test_interfaces_l2tpv3.py
index 74fd4f6c6..24cb9464e 100755
--- a/smoketest/scripts/cli/test_interfaces_l2tpv3.py
+++ b/smoketest/scripts/cli/test_interfaces_l2tpv3.py
@@ -20,7 +20,7 @@ import unittest
from base_interfaces_test import BasicInterfaceTest
from vyos.util import cmd
-class GeneveInterfaceTest(BasicInterfaceTest.BaseTest):
+class GeneveInterfaceTest(BasicInterfaceTest.TestCase):
@classmethod
def setUpClass(cls):
cls._test_ip = True
@@ -37,6 +37,8 @@ class GeneveInterfaceTest(BasicInterfaceTest.BaseTest):
'source-port 2020', 'destination-port 20202'],
}
cls._interfaces = list(cls._options)
+ # call base-classes classmethod
+ super(cls, cls).setUpClass()
def test_add_single_ip_address(self):
super().test_add_single_ip_address()
diff --git a/smoketest/scripts/cli/test_interfaces_loopback.py b/smoketest/scripts/cli/test_interfaces_loopback.py
index 77dd4c1b5..85b5ca6d6 100755
--- a/smoketest/scripts/cli/test_interfaces_loopback.py
+++ b/smoketest/scripts/cli/test_interfaces_loopback.py
@@ -23,16 +23,17 @@ from vyos.validate import is_intf_addr_assigned
loopbacks = ['127.0.0.1', '::1']
-class LoopbackInterfaceTest(BasicInterfaceTest.BaseTest):
+class LoopbackInterfaceTest(BasicInterfaceTest.TestCase):
@classmethod
def setUpClass(cls):
- cls._base_path = ['interfaces', 'loopback']
- cls._interfaces = ['lo']
+ cls._base_path = ['interfaces', 'loopback']
+ cls._interfaces = ['lo']
+ # call base-classes classmethod
+ super(cls, cls).setUpClass()
def tearDown(self):
- self.session.delete(self._base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(self._base_path)
+ self.cli_commit()
# loopback interface must persist!
for intf in self._interfaces:
diff --git a/smoketest/scripts/cli/test_interfaces_macsec.py b/smoketest/scripts/cli/test_interfaces_macsec.py
index 2f1898b6f..e4280a5b7 100755
--- a/smoketest/scripts/cli/test_interfaces_macsec.py
+++ b/smoketest/scripts/cli/test_interfaces_macsec.py
@@ -25,7 +25,7 @@ from vyos.configsession import ConfigSessionError
from vyos.ifconfig import Section
from vyos.util import cmd
from vyos.util import read_file
-from vyos.util import get_json_iface_options
+from vyos.util import get_interface_config
from vyos.util import process_named_running
def get_config_value(interface, key):
@@ -34,23 +34,25 @@ def get_config_value(interface, key):
return tmp[0]
def get_cipher(interface):
- tmp = get_json_iface_options(interface)
+ tmp = get_interface_config(interface)
return tmp['linkinfo']['info_data']['cipher_suite'].lower()
-class MACsecInterfaceTest(BasicInterfaceTest.BaseTest):
+class MACsecInterfaceTest(BasicInterfaceTest.TestCase):
@classmethod
def setUpClass(cls):
- cls._test_ip = True
- cls._test_ipv6 = True
- cls._base_path = ['interfaces', 'macsec']
- cls._options = { 'macsec0': ['source-interface eth0', 'security cipher gcm-aes-128'] }
+ cls._test_ip = True
+ cls._test_ipv6 = True
+ cls._base_path = ['interfaces', 'macsec']
+ cls._options = { 'macsec0': ['source-interface eth0', 'security cipher gcm-aes-128'] }
- # if we have a physical eth1 interface, add a second macsec instance
- if 'eth1' in Section.interfaces('ethernet'):
- macsec = { 'macsec1': [f'source-interface eth1', 'security cipher gcm-aes-128'] }
- cls._options.update(macsec)
+ # if we have a physical eth1 interface, add a second macsec instance
+ if 'eth1' in Section.interfaces('ethernet'):
+ macsec = { 'macsec1': [f'source-interface eth1', 'security cipher gcm-aes-128'] }
+ cls._options.update(macsec)
- cls._interfaces = list(cls._options)
+ cls._interfaces = list(cls._options)
+ # call base-classes classmethod
+ super(cls, cls).setUpClass()
def test_macsec_encryption(self):
# MACsec can be operating in authentication and encryption mode - both
@@ -66,31 +68,31 @@ class MACsecInterfaceTest(BasicInterfaceTest.BaseTest):
if option.split()[0] == 'source-interface':
src_interface = option.split()[1]
- self.session.set(self._base_path + [interface] + option.split())
+ self.cli_set(self._base_path + [interface] + option.split())
# Encrypt link
- self.session.set(self._base_path + [interface, 'security', 'encrypt'])
+ self.cli_set(self._base_path + [interface, 'security', 'encrypt'])
# check validate() - Physical source interface MTU must be higher then our MTU
- self.session.set(self._base_path + [interface, 'mtu', '1500'])
+ self.cli_set(self._base_path + [interface, 'mtu', '1500'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(self._base_path + [interface, 'mtu'])
+ self.cli_commit()
+ self.cli_delete(self._base_path + [interface, 'mtu'])
# check validate() - MACsec security keys mandartory when encryption is enabled
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(self._base_path + [interface, 'security', 'mka', 'cak', mak_cak])
+ self.cli_commit()
+ self.cli_set(self._base_path + [interface, 'security', 'mka', 'cak', mak_cak])
# check validate() - MACsec security keys mandartory when encryption is enabled
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(self._base_path + [interface, 'security', 'mka', 'ckn', mak_ckn])
+ self.cli_commit()
+ self.cli_set(self._base_path + [interface, 'security', 'mka', 'ckn', mak_ckn])
- self.session.set(self._base_path + [interface, 'security', 'replay-window', replay_window])
+ self.cli_set(self._base_path + [interface, 'security', 'replay-window', replay_window])
# final commit of settings
- self.session.commit()
+ self.cli_commit()
tmp = get_config_value(src_interface, 'macsec_integ_only')
self.assertTrue("0" in tmp)
@@ -117,20 +119,20 @@ class MACsecInterfaceTest(BasicInterfaceTest.BaseTest):
def test_macsec_gcm_aes_128(self):
interface = 'macsec1'
cipher = 'gcm-aes-128'
- self.session.set(self._base_path + [interface])
+ self.cli_set(self._base_path + [interface])
# check validate() - source interface is mandatory
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(self._base_path + [interface, 'source-interface', 'eth0'])
+ self.cli_commit()
+ self.cli_set(self._base_path + [interface, 'source-interface', 'eth0'])
# check validate() - cipher is mandatory
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(self._base_path + [interface, 'security', 'cipher', cipher])
+ self.cli_commit()
+ self.cli_set(self._base_path + [interface, 'security', 'cipher', cipher])
# final commit and verify
- self.session.commit()
+ self.cli_commit()
self.assertIn(interface, interfaces())
self.assertIn(interface, interfaces())
self.assertEqual(cipher, get_cipher(interface))
@@ -138,20 +140,20 @@ class MACsecInterfaceTest(BasicInterfaceTest.BaseTest):
def test_macsec_gcm_aes_256(self):
interface = 'macsec4'
cipher = 'gcm-aes-256'
- self.session.set(self._base_path + [interface])
+ self.cli_set(self._base_path + [interface])
# check validate() - source interface is mandatory
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(self._base_path + [interface, 'source-interface', 'eth0'])
+ self.cli_commit()
+ self.cli_set(self._base_path + [interface, 'source-interface', 'eth0'])
# check validate() - cipher is mandatory
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(self._base_path + [interface, 'security', 'cipher', cipher])
+ self.cli_commit()
+ self.cli_set(self._base_path + [interface, 'security', 'cipher', cipher])
# final commit and verify
- self.session.commit()
+ self.cli_commit()
self.assertIn(interface, interfaces())
self.assertEqual(cipher, get_cipher(interface))
@@ -163,24 +165,24 @@ class MACsecInterfaceTest(BasicInterfaceTest.BaseTest):
for interface, option_value in self._options.items():
for option in option_value:
- self.session.set(self._base_path + [interface] + option.split())
+ self.cli_set(self._base_path + [interface] + option.split())
if option.split()[0] == 'source-interface':
src_interface = option.split()[1]
- self.session.set(base_bridge + ['member', 'interface', src_interface])
+ self.cli_set(base_bridge + ['member', 'interface', src_interface])
# check validate() - Source interface must not already be a member of a bridge
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(base_bridge)
+ self.cli_commit()
+ self.cli_delete(base_bridge)
- self.session.set(base_bond + ['member', 'interface', src_interface])
+ self.cli_set(base_bond + ['member', 'interface', src_interface])
# check validate() - Source interface must not already be a member of a bridge
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(base_bond)
+ self.cli_commit()
+ self.cli_delete(base_bond)
# final commit and verify
- self.session.commit()
+ self.cli_commit()
self.assertIn(interface, interfaces())
if __name__ == '__main__':
diff --git a/smoketest/scripts/cli/test_interfaces_openvpn.py b/smoketest/scripts/cli/test_interfaces_openvpn.py
index a2a1a85ec..655ee770d 100755
--- a/smoketest/scripts/cli/test_interfaces_openvpn.py
+++ b/smoketest/scripts/cli/test_interfaces_openvpn.py
@@ -21,6 +21,8 @@ from glob import glob
from ipaddress import IPv4Network
from netifaces import interfaces
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
from vyos.util import cmd
@@ -58,85 +60,83 @@ def get_vrf(interface):
tmp = tmp.replace('upper_', '')
return tmp
-class TestInterfacesOpenVPN(unittest.TestCase):
+class TestInterfacesOpenVPN(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
- self.session.set(['interfaces', 'dummy', dummy_if, 'address', '192.0.2.1/32'])
- self.session.set(['vrf', 'name', vrf_name, 'table', '12345'])
+ self.cli_set(['interfaces', 'dummy', dummy_if, 'address', '192.0.2.1/32'])
+ self.cli_set(['vrf', 'name', vrf_name, 'table', '12345'])
def tearDown(self):
- self.session.delete(base_path)
- self.session.delete(['interfaces', 'dummy', dummy_if])
- self.session.delete(['vrf'])
- self.session.commit()
- del self.session
+ self.cli_delete(base_path)
+ self.cli_delete(['interfaces', 'dummy', dummy_if])
+ self.cli_delete(['vrf'])
+ self.cli_commit()
def test_openvpn_client_verify(self):
# Create OpenVPN client interface and test verify() steps.
interface = 'vtun2000'
path = base_path + [interface]
- self.session.set(path + ['mode', 'client'])
+ self.cli_set(path + ['mode', 'client'])
# check validate() - cannot specify both "encryption disable-ncp" and
# "encryption ncp-ciphers" at the same time
- self.session.set(path + ['encryption', 'disable-ncp'])
- self.session.set(path + ['encryption', 'ncp-ciphers', 'aes192gcm'])
+ self.cli_set(path + ['encryption', 'disable-ncp'])
+ self.cli_set(path + ['encryption', 'ncp-ciphers', 'aes192gcm'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(path + ['encryption', 'ncp-ciphers'])
+ self.cli_commit()
+ self.cli_delete(path + ['encryption', 'ncp-ciphers'])
# check validate() - cannot specify local-port in client mode
- self.session.set(path + ['local-port', '5000'])
+ self.cli_set(path + ['local-port', '5000'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(path + ['local-port'])
+ self.cli_commit()
+ self.cli_delete(path + ['local-port'])
# check validate() - cannot specify local-host in client mode
- self.session.set(path + ['local-host', '127.0.0.1'])
+ self.cli_set(path + ['local-host', '127.0.0.1'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(path + ['local-host'])
+ self.cli_commit()
+ self.cli_delete(path + ['local-host'])
# check validate() - cannot specify protocol tcp-passive in client mode
- self.session.set(path + ['protocol', 'tcp-passive'])
+ self.cli_set(path + ['protocol', 'tcp-passive'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(path + ['protocol'])
+ self.cli_commit()
+ self.cli_delete(path + ['protocol'])
# check validate() - remote-host must be set in client mode
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(path + ['remote-host', '192.0.9.9'])
+ self.cli_commit()
+ self.cli_set(path + ['remote-host', '192.0.9.9'])
# check validate() - cannot specify "tls dh-file" in client mode
- self.session.set(path + ['tls', 'dh-file', dh_pem])
+ self.cli_set(path + ['tls', 'dh-file', dh_pem])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(path + ['tls'])
+ self.cli_commit()
+ self.cli_delete(path + ['tls'])
# check validate() - must specify one of "shared-secret-key-file" and "tls"
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(path + ['shared-secret-key-file', s2s_key])
+ self.cli_commit()
+ self.cli_set(path + ['shared-secret-key-file', s2s_key])
# check validate() - must specify one of "shared-secret-key-file" and "tls"
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(path + ['shared-secret-key-file', s2s_key])
+ self.cli_commit()
+ self.cli_delete(path + ['shared-secret-key-file', s2s_key])
- self.session.set(path + ['tls', 'ca-cert-file', ca_cert])
- self.session.set(path + ['tls', 'cert-file', ssl_cert])
- self.session.set(path + ['tls', 'key-file', ssl_key])
+ self.cli_set(path + ['tls', 'ca-cert-file', ca_cert])
+ self.cli_set(path + ['tls', 'cert-file', ssl_cert])
+ self.cli_set(path + ['tls', 'key-file', ssl_key])
# check validate() - can not have auth username without a password
- self.session.set(path + ['authentication', 'username', 'vyos'])
+ self.cli_set(path + ['authentication', 'username', 'vyos'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(path + ['authentication', 'password', 'vyos'])
+ self.cli_commit()
+ self.cli_set(path + ['authentication', 'password', 'vyos'])
# client commit must pass
- self.session.commit()
+ self.cli_commit()
self.assertTrue(process_named_running(PROCESS_NAME))
self.assertIn(interface, interfaces())
@@ -152,22 +152,22 @@ class TestInterfacesOpenVPN(unittest.TestCase):
path = base_path + [interface]
auth_hash = 'sha1'
- self.session.set(path + ['device-type', 'tun'])
- self.session.set(path + ['encryption', 'cipher', 'aes256'])
- self.session.set(path + ['hash', auth_hash])
- self.session.set(path + ['mode', 'client'])
- self.session.set(path + ['persistent-tunnel'])
- self.session.set(path + ['protocol', protocol])
- self.session.set(path + ['remote-host', remote_host])
- self.session.set(path + ['remote-port', remote_port])
- self.session.set(path + ['tls', 'ca-cert-file', ca_cert])
- self.session.set(path + ['tls', 'cert-file', ssl_cert])
- self.session.set(path + ['tls', 'key-file', ssl_key])
- self.session.set(path + ['vrf', vrf_name])
- self.session.set(path + ['authentication', 'username', interface+'user'])
- self.session.set(path + ['authentication', 'password', interface+'secretpw'])
-
- self.session.commit()
+ self.cli_set(path + ['device-type', 'tun'])
+ self.cli_set(path + ['encryption', 'cipher', 'aes256'])
+ self.cli_set(path + ['hash', auth_hash])
+ self.cli_set(path + ['mode', 'client'])
+ self.cli_set(path + ['persistent-tunnel'])
+ self.cli_set(path + ['protocol', protocol])
+ self.cli_set(path + ['remote-host', remote_host])
+ self.cli_set(path + ['remote-port', remote_port])
+ self.cli_set(path + ['tls', 'ca-cert-file', ca_cert])
+ self.cli_set(path + ['tls', 'cert-file', ssl_cert])
+ self.cli_set(path + ['tls', 'key-file', ssl_key])
+ self.cli_set(path + ['vrf', vrf_name])
+ self.cli_set(path + ['authentication', 'username', interface+'user'])
+ self.cli_set(path + ['authentication', 'password', interface+'secretpw'])
+
+ self.cli_commit()
for ii in num_range:
interface = f'vtun{ii}'
@@ -200,8 +200,8 @@ class TestInterfacesOpenVPN(unittest.TestCase):
self.assertIn(f'{interface}secretpw', pw)
# check that no interface remained after deleting them
- self.session.delete(base_path)
- self.session.commit()
+ self.cli_delete(base_path)
+ self.cli_commit()
for ii in num_range:
interface = f'vtun{ii}'
@@ -213,104 +213,104 @@ class TestInterfacesOpenVPN(unittest.TestCase):
path = base_path + [interface]
# check validate() - must speciy operating mode
- self.session.set(path)
+ self.cli_set(path)
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(path + ['mode', 'server'])
+ self.cli_commit()
+ self.cli_set(path + ['mode', 'server'])
# check validate() - cannot specify protocol tcp-active in server mode
- self.session.set(path + ['protocol', 'tcp-active'])
+ self.cli_set(path + ['protocol', 'tcp-active'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(path + ['protocol'])
+ self.cli_commit()
+ self.cli_delete(path + ['protocol'])
# check validate() - cannot specify local-port in client mode
- self.session.set(path + ['remote-port', '5000'])
+ self.cli_set(path + ['remote-port', '5000'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(path + ['remote-port'])
+ self.cli_commit()
+ self.cli_delete(path + ['remote-port'])
# check validate() - cannot specify local-host in client mode
- self.session.set(path + ['remote-host', '127.0.0.1'])
+ self.cli_set(path + ['remote-host', '127.0.0.1'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(path + ['remote-host'])
+ self.cli_commit()
+ self.cli_delete(path + ['remote-host'])
# check validate() - must specify "tls dh-file" when not using EC keys
# in server mode
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(path + ['tls', 'dh-file', dh_pem])
+ self.cli_commit()
+ self.cli_set(path + ['tls', 'dh-file', dh_pem])
# check validate() - must specify "server subnet" or add interface to
# bridge in server mode
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
# check validate() - server client-ip-pool is too large
# [100.64.0.4 -> 100.127.255.251 = 4194295], maximum is 65536 addresses.
- self.session.set(path + ['server', 'subnet', '100.64.0.0/10'])
+ self.cli_set(path + ['server', 'subnet', '100.64.0.0/10'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
# check validate() - cannot specify more than 1 IPv4 and 1 IPv6 server subnet
- self.session.set(path + ['server', 'subnet', '100.64.0.0/20'])
+ self.cli_set(path + ['server', 'subnet', '100.64.0.0/20'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(path + ['server', 'subnet', '100.64.0.0/10'])
+ self.cli_commit()
+ self.cli_delete(path + ['server', 'subnet', '100.64.0.0/10'])
# check validate() - must specify "tls ca-cert-file"
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(path + ['tls', 'ca-cert-file', ca_cert])
+ self.cli_commit()
+ self.cli_set(path + ['tls', 'ca-cert-file', ca_cert])
# check validate() - must specify "tls cert-file"
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(path + ['tls', 'cert-file', ssl_cert])
+ self.cli_commit()
+ self.cli_set(path + ['tls', 'cert-file', ssl_cert])
# check validate() - must specify "tls key-file"
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(path + ['tls', 'key-file', ssl_key])
+ self.cli_commit()
+ self.cli_set(path + ['tls', 'key-file', ssl_key])
# check validate() - cannot specify "tls role" in client-server mode'
- self.session.set(path + ['tls', 'role', 'active'])
+ self.cli_set(path + ['tls', 'role', 'active'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
# check validate() - cannot specify "tls role" in client-server mode'
- self.session.set(path + ['tls', 'auth-file', auth_key])
+ self.cli_set(path + ['tls', 'auth-file', auth_key])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
# check validate() - cannot specify "tcp-passive" when "tls role" is "active"
- self.session.set(path + ['protocol', 'tcp-passive'])
+ self.cli_set(path + ['protocol', 'tcp-passive'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(path + ['protocol'])
+ self.cli_commit()
+ self.cli_delete(path + ['protocol'])
# check validate() - cannot specify "tls dh-file" when "tls role" is "active"
- self.session.set(path + ['tls', 'dh-file', dh_pem])
+ self.cli_set(path + ['tls', 'dh-file', dh_pem])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(path + ['tls', 'dh-file'])
+ self.cli_commit()
+ self.cli_delete(path + ['tls', 'dh-file'])
# Now test the other path with tls role passive
- self.session.set(path + ['tls', 'role', 'passive'])
+ self.cli_set(path + ['tls', 'role', 'passive'])
# check validate() - cannot specify "tcp-active" when "tls role" is "passive"
- self.session.set(path + ['protocol', 'tcp-active'])
+ self.cli_set(path + ['protocol', 'tcp-active'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(path + ['protocol'])
+ self.cli_commit()
+ self.cli_delete(path + ['protocol'])
# check validate() - must specify "tls dh-file" when "tls role" is "passive"
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(path + ['tls', 'dh-file', dh_pem])
+ self.cli_commit()
+ self.cli_set(path + ['tls', 'dh-file', dh_pem])
- self.session.commit()
+ self.cli_commit()
self.assertTrue(process_named_running(PROCESS_NAME))
self.assertIn(interface, interfaces())
@@ -330,29 +330,29 @@ class TestInterfacesOpenVPN(unittest.TestCase):
path = base_path + [interface]
port = str(2000 + ii)
- self.session.set(path + ['device-type', 'tun'])
- self.session.set(path + ['encryption', 'cipher', 'aes192'])
- self.session.set(path + ['hash', auth_hash])
- self.session.set(path + ['mode', 'server'])
- self.session.set(path + ['local-port', port])
- self.session.set(path + ['server', 'subnet', subnet])
- self.session.set(path + ['server', 'topology', 'subnet'])
- self.session.set(path + ['keep-alive', 'failure-count', '5'])
- self.session.set(path + ['keep-alive', 'interval', '5'])
+ self.cli_set(path + ['device-type', 'tun'])
+ self.cli_set(path + ['encryption', 'cipher', 'aes192'])
+ self.cli_set(path + ['hash', auth_hash])
+ self.cli_set(path + ['mode', 'server'])
+ self.cli_set(path + ['local-port', port])
+ self.cli_set(path + ['server', 'subnet', subnet])
+ self.cli_set(path + ['server', 'topology', 'subnet'])
+ self.cli_set(path + ['keep-alive', 'failure-count', '5'])
+ self.cli_set(path + ['keep-alive', 'interval', '5'])
# clients
- self.session.set(path + ['server', 'client', 'client1', 'ip', client_ip])
+ self.cli_set(path + ['server', 'client', 'client1', 'ip', client_ip])
for route in client1_routes:
- self.session.set(path + ['server', 'client', 'client1', 'subnet', route])
+ self.cli_set(path + ['server', 'client', 'client1', 'subnet', route])
- self.session.set(path + ['replace-default-route'])
- self.session.set(path + ['tls', 'ca-cert-file', ca_cert])
- self.session.set(path + ['tls', 'cert-file', ssl_cert])
- self.session.set(path + ['tls', 'key-file', ssl_key])
- self.session.set(path + ['tls', 'dh-file', dh_pem])
- self.session.set(path + ['vrf', vrf_name])
+ self.cli_set(path + ['replace-default-route'])
+ self.cli_set(path + ['tls', 'ca-cert-file', ca_cert])
+ self.cli_set(path + ['tls', 'cert-file', ssl_cert])
+ self.cli_set(path + ['tls', 'key-file', ssl_key])
+ self.cli_set(path + ['tls', 'dh-file', dh_pem])
+ self.cli_set(path + ['vrf', vrf_name])
- self.session.commit()
+ self.cli_commit()
for ii in num_range:
interface = f'vtun{ii}'
@@ -404,8 +404,8 @@ class TestInterfacesOpenVPN(unittest.TestCase):
self.assertIn(interface, interfaces())
# check that no interface remained after deleting them
- self.session.delete(base_path)
- self.session.commit()
+ self.cli_delete(base_path)
+ self.cli_commit()
for ii in num_range:
interface = f'vtun{ii}'
@@ -423,23 +423,23 @@ class TestInterfacesOpenVPN(unittest.TestCase):
path = base_path + [interface]
port = str(2000 + ii)
- self.session.set(path + ['device-type', 'tun'])
- self.session.set(path + ['encryption', 'cipher', 'aes192'])
- self.session.set(path + ['hash', auth_hash])
- self.session.set(path + ['mode', 'server'])
- self.session.set(path + ['local-port', port])
- self.session.set(path + ['server', 'subnet', subnet])
- self.session.set(path + ['server', 'topology', 'net30'])
- self.session.set(path + ['replace-default-route'])
- self.session.set(path + ['keep-alive', 'failure-count', '10'])
- self.session.set(path + ['keep-alive', 'interval', '5'])
- self.session.set(path + ['tls', 'ca-cert-file', ca_cert])
- self.session.set(path + ['tls', 'cert-file', ssl_cert])
- self.session.set(path + ['tls', 'key-file', ssl_key])
- self.session.set(path + ['tls', 'dh-file', dh_pem])
- self.session.set(path + ['vrf', vrf_name])
-
- self.session.commit()
+ self.cli_set(path + ['device-type', 'tun'])
+ self.cli_set(path + ['encryption', 'cipher', 'aes192'])
+ self.cli_set(path + ['hash', auth_hash])
+ self.cli_set(path + ['mode', 'server'])
+ self.cli_set(path + ['local-port', port])
+ self.cli_set(path + ['server', 'subnet', subnet])
+ self.cli_set(path + ['server', 'topology', 'net30'])
+ self.cli_set(path + ['replace-default-route'])
+ self.cli_set(path + ['keep-alive', 'failure-count', '10'])
+ self.cli_set(path + ['keep-alive', 'interval', '5'])
+ self.cli_set(path + ['tls', 'ca-cert-file', ca_cert])
+ self.cli_set(path + ['tls', 'cert-file', ssl_cert])
+ self.cli_set(path + ['tls', 'key-file', ssl_key])
+ self.cli_set(path + ['tls', 'dh-file', dh_pem])
+ self.cli_set(path + ['vrf', vrf_name])
+
+ self.cli_commit()
for ii in num_range:
interface = f'vtun{ii}'
@@ -479,8 +479,8 @@ class TestInterfacesOpenVPN(unittest.TestCase):
self.assertIn(interface, interfaces())
# check that no interface remained after deleting them
- self.session.delete(base_path)
- self.session.commit()
+ self.cli_delete(base_path)
+ self.cli_commit()
for ii in num_range:
interface = f'vtun{ii}'
@@ -493,57 +493,57 @@ class TestInterfacesOpenVPN(unittest.TestCase):
interface = 'vtun5000'
path = base_path + [interface]
- self.session.set(path + ['mode', 'site-to-site'])
+ self.cli_set(path + ['mode', 'site-to-site'])
# check validate() - encryption ncp-ciphers cannot be specified in site-to-site mode
- self.session.set(path + ['encryption', 'ncp-ciphers', 'aes192gcm'])
+ self.cli_set(path + ['encryption', 'ncp-ciphers', 'aes192gcm'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(path + ['encryption'])
+ self.cli_commit()
+ self.cli_delete(path + ['encryption'])
# check validate() - must specify "local-address" or add interface to bridge
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(path + ['local-address', '10.0.0.1'])
- self.session.set(path + ['local-address', '2001:db8:1::1'])
+ self.cli_commit()
+ self.cli_set(path + ['local-address', '10.0.0.1'])
+ self.cli_set(path + ['local-address', '2001:db8:1::1'])
# check validate() - cannot specify more than 1 IPv4 local-address
- self.session.set(path + ['local-address', '10.0.0.2'])
+ self.cli_set(path + ['local-address', '10.0.0.2'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(path + ['local-address', '10.0.0.2'])
+ self.cli_commit()
+ self.cli_delete(path + ['local-address', '10.0.0.2'])
# check validate() - cannot specify more than 1 IPv6 local-address
- self.session.set(path + ['local-address', '2001:db8:1::2'])
+ self.cli_set(path + ['local-address', '2001:db8:1::2'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(path + ['local-address', '2001:db8:1::2'])
+ self.cli_commit()
+ self.cli_delete(path + ['local-address', '2001:db8:1::2'])
# check validate() - IPv4 "local-address" requires IPv4 "remote-address"
# or IPv4 "local-address subnet"
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(path + ['remote-address', '192.168.0.1'])
- self.session.set(path + ['remote-address', '2001:db8:ffff::1'])
+ self.cli_commit()
+ self.cli_set(path + ['remote-address', '192.168.0.1'])
+ self.cli_set(path + ['remote-address', '2001:db8:ffff::1'])
# check validate() - Cannot specify more than 1 IPv4 "remote-address"
- self.session.set(path + ['remote-address', '192.168.0.2'])
+ self.cli_set(path + ['remote-address', '192.168.0.2'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(path + ['remote-address', '192.168.0.2'])
+ self.cli_commit()
+ self.cli_delete(path + ['remote-address', '192.168.0.2'])
# check validate() - Cannot specify more than 1 IPv6 "remote-address"
- self.session.set(path + ['remote-address', '2001:db8:ffff::2'])
+ self.cli_set(path + ['remote-address', '2001:db8:ffff::2'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(path + ['remote-address', '2001:db8:ffff::2'])
+ self.cli_commit()
+ self.cli_delete(path + ['remote-address', '2001:db8:ffff::2'])
# check validate() - Must specify one of "shared-secret-key-file" and "tls"
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(path + ['shared-secret-key-file', s2s_key])
+ self.cli_commit()
+ self.cli_set(path + ['shared-secret-key-file', s2s_key])
- self.session.commit()
+ self.cli_commit()
def test_openvpn_site2site_interfaces_tun(self):
# Create two OpenVPN site-to-site interfaces
@@ -561,23 +561,23 @@ class TestInterfacesOpenVPN(unittest.TestCase):
path = base_path + [interface]
port = str(3000 + ii)
- self.session.set(path + ['local-address', local_address])
+ self.cli_set(path + ['local-address', local_address])
# even numbers use tun type, odd numbers use tap type
if ii % 2 == 0:
- self.session.set(path + ['device-type', 'tun'])
+ self.cli_set(path + ['device-type', 'tun'])
else:
- self.session.set(path + ['device-type', 'tap'])
- self.session.set(path + ['local-address', local_address, 'subnet-mask', local_address_subnet])
+ self.cli_set(path + ['device-type', 'tap'])
+ self.cli_set(path + ['local-address', local_address, 'subnet-mask', local_address_subnet])
- self.session.set(path + ['mode', 'site-to-site'])
- self.session.set(path + ['local-port', port])
- self.session.set(path + ['remote-port', port])
- self.session.set(path + ['shared-secret-key-file', s2s_key])
- self.session.set(path + ['remote-address', remote_address])
- self.session.set(path + ['vrf', vrf_name])
+ self.cli_set(path + ['mode', 'site-to-site'])
+ self.cli_set(path + ['local-port', port])
+ self.cli_set(path + ['remote-port', port])
+ self.cli_set(path + ['shared-secret-key-file', s2s_key])
+ self.cli_set(path + ['remote-address', remote_address])
+ self.cli_set(path + ['vrf', vrf_name])
- self.session.commit()
+ self.cli_commit()
for ii in num_range:
interface = f'vtun{ii}'
@@ -608,8 +608,8 @@ class TestInterfacesOpenVPN(unittest.TestCase):
# check that no interface remained after deleting them
- self.session.delete(base_path)
- self.session.commit()
+ self.cli_delete(base_path)
+ self.cli_commit()
for ii in num_range:
interface = f'vtun{ii}'
diff --git a/smoketest/scripts/cli/test_interfaces_pppoe.py b/smoketest/scripts/cli/test_interfaces_pppoe.py
index 285c756e2..b8682fe71 100755
--- a/smoketest/scripts/cli/test_interfaces_pppoe.py
+++ b/smoketest/scripts/cli/test_interfaces_pppoe.py
@@ -15,11 +15,13 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import re
-import os
import unittest
from psutil import process_iter
-from vyos.configsession import ConfigSession, ConfigSessionError
+from base_vyostest_shim import VyOSUnitTestSHIM
+
+from vyos.configsession import ConfigSession
+from vyos.configsession import ConfigSessionError
from vyos.util import read_file
config_file = '/etc/ppp/peers/{}'
@@ -42,16 +44,14 @@ def get_dhcp6c_config_value(interface, key):
out.append(item.replace(';',''))
return out
-class PPPoEInterfaceTest(unittest.TestCase):
+class PPPoEInterfaceTest(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
self._interfaces = ['pppoe10', 'pppoe20', 'pppoe30']
self._source_interface = 'eth0'
def tearDown(self):
- self.session.delete(base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_pppoe_client(self):
# Check if PPPoE dialer can be configured and runs
@@ -60,19 +60,19 @@ class PPPoEInterfaceTest(unittest.TestCase):
passwd = 'VyOS-passwd-' + interface
mtu = '1400'
- self.session.set(base_path + [interface, 'authentication', 'user', user])
- self.session.set(base_path + [interface, 'authentication', 'password', passwd])
- self.session.set(base_path + [interface, 'default-route', 'auto'])
- self.session.set(base_path + [interface, 'mtu', mtu])
- self.session.set(base_path + [interface, 'no-peer-dns'])
+ self.cli_set(base_path + [interface, 'authentication', 'user', user])
+ self.cli_set(base_path + [interface, 'authentication', 'password', passwd])
+ self.cli_set(base_path + [interface, 'default-route', 'auto'])
+ self.cli_set(base_path + [interface, 'mtu', mtu])
+ self.cli_set(base_path + [interface, 'no-peer-dns'])
# check validate() - a source-interface is required
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(base_path + [interface, 'source-interface', self._source_interface])
+ self.cli_commit()
+ self.cli_set(base_path + [interface, 'source-interface', self._source_interface])
# commit changes
- self.session.commit()
+ self.cli_commit()
# verify configuration file(s)
for interface in self._interfaces:
@@ -101,12 +101,12 @@ class PPPoEInterfaceTest(unittest.TestCase):
def test_pppoe_clent_disabled_interface(self):
# Check if PPPoE Client can be disabled
for interface in self._interfaces:
- self.session.set(base_path + [interface, 'authentication', 'user', 'vyos'])
- self.session.set(base_path + [interface, 'authentication', 'password', 'vyos'])
- self.session.set(base_path + [interface, 'source-interface', self._source_interface])
- self.session.set(base_path + [interface, 'disable'])
+ self.cli_set(base_path + [interface, 'authentication', 'user', 'vyos'])
+ self.cli_set(base_path + [interface, 'authentication', 'password', 'vyos'])
+ self.cli_set(base_path + [interface, 'source-interface', self._source_interface])
+ self.cli_set(base_path + [interface, 'disable'])
- self.session.commit()
+ self.cli_commit()
# Validate PPPoE client process
running = False
@@ -124,21 +124,21 @@ class PPPoEInterfaceTest(unittest.TestCase):
sla_id = '0'
sla_len = '8'
for interface in self._interfaces:
- self.session.set(base_path + [interface, 'authentication', 'user', 'vyos'])
- self.session.set(base_path + [interface, 'authentication', 'password', 'vyos'])
- self.session.set(base_path + [interface, 'default-route', 'none'])
- self.session.set(base_path + [interface, 'no-peer-dns'])
- self.session.set(base_path + [interface, 'source-interface', self._source_interface])
- self.session.set(base_path + [interface, 'ipv6', 'address', 'autoconf'])
+ self.cli_set(base_path + [interface, 'authentication', 'user', 'vyos'])
+ self.cli_set(base_path + [interface, 'authentication', 'password', 'vyos'])
+ self.cli_set(base_path + [interface, 'default-route', 'none'])
+ self.cli_set(base_path + [interface, 'no-peer-dns'])
+ self.cli_set(base_path + [interface, 'source-interface', self._source_interface])
+ self.cli_set(base_path + [interface, 'ipv6', 'address', 'autoconf'])
# prefix delegation stuff
dhcpv6_pd_base = base_path + [interface, 'dhcpv6-options', 'pd', '0']
- self.session.set(dhcpv6_pd_base + ['length', '56'])
- self.session.set(dhcpv6_pd_base + ['interface', self._source_interface, 'address', address])
- self.session.set(dhcpv6_pd_base + ['interface', self._source_interface, 'sla-id', sla_id])
+ self.cli_set(dhcpv6_pd_base + ['length', '56'])
+ self.cli_set(dhcpv6_pd_base + ['interface', self._source_interface, 'address', address])
+ self.cli_set(dhcpv6_pd_base + ['interface', self._source_interface, 'sla-id', sla_id])
# commit changes
- self.session.commit()
+ self.cli_commit()
# verify "normal" PPPoE value - 1492 is default MTU
tmp = get_config_value(interface, 'mtu')[1]
diff --git a/smoketest/scripts/cli/test_interfaces_pseudo_ethernet.py b/smoketest/scripts/cli/test_interfaces_pseudo_ethernet.py
index f4cb4cdc9..ff343bb87 100755
--- a/smoketest/scripts/cli/test_interfaces_pseudo_ethernet.py
+++ b/smoketest/scripts/cli/test_interfaces_pseudo_ethernet.py
@@ -18,7 +18,7 @@ import unittest
from base_interfaces_test import BasicInterfaceTest
-class PEthInterfaceTest(BasicInterfaceTest.BaseTest):
+class PEthInterfaceTest(BasicInterfaceTest.TestCase):
@classmethod
def setUpClass(cls):
cls._test_ip = True
@@ -34,6 +34,8 @@ class PEthInterfaceTest(BasicInterfaceTest.BaseTest):
'peth1': ['source-interface eth1'],
}
cls._interfaces = list(cls._options)
+ # call base-classes classmethod
+ super(cls, cls).setUpClass()
if __name__ == '__main__':
unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_interfaces_tunnel.py b/smoketest/scripts/cli/test_interfaces_tunnel.py
index cad6764e6..6af31ddff 100755
--- a/smoketest/scripts/cli/test_interfaces_tunnel.py
+++ b/smoketest/scripts/cli/test_interfaces_tunnel.py
@@ -16,19 +16,18 @@
import unittest
-from vyos.configsession import ConfigSession
+from base_interfaces_test import BasicInterfaceTest
+
from vyos.configsession import ConfigSessionError
-from vyos.util import get_json_iface_options
+from vyos.util import get_interface_config
from vyos.template import inc_ip
-from base_interfaces_test import BasicInterfaceTest
-
remote_ip4 = '192.0.2.100'
remote_ip6 = '2001:db8::ffff'
source_if = 'dum2222'
mtu = 1476
-class TunnelInterfaceTest(BasicInterfaceTest.BaseTest):
+class TunnelInterfaceTest(BasicInterfaceTest.TestCase):
@classmethod
def setUpClass(cls):
cls._test_ip = True
@@ -42,14 +41,16 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest):
'tun20': ['encapsulation gre', 'remote 192.0.2.20', 'source-address ' + cls.local_v4],
}
cls._interfaces = list(cls._options)
+ # call base-classes classmethod
+ super(cls, cls).setUpClass()
def setUp(self):
super().setUp()
- self.session.set(['interfaces', 'dummy', source_if, 'address', self.local_v4 + '/32'])
- self.session.set(['interfaces', 'dummy', source_if, 'address', self.local_v6 + '/128'])
+ self.cli_set(['interfaces', 'dummy', source_if, 'address', self.local_v4 + '/32'])
+ self.cli_set(['interfaces', 'dummy', source_if, 'address', self.local_v6 + '/128'])
def tearDown(self):
- self.session.delete(['interfaces', 'dummy', source_if])
+ self.cli_delete(['interfaces', 'dummy', source_if])
super().tearDown()
def test_ipv4_encapsulations(self):
@@ -59,32 +60,32 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest):
interface = f'tun1000'
local_if_addr = f'10.10.200.1/24'
for encapsulation in ['ipip', 'sit', 'gre', 'gretap']:
- self.session.set(self._base_path + [interface, 'address', local_if_addr])
- self.session.set(self._base_path + [interface, 'encapsulation', encapsulation])
- self.session.set(self._base_path + [interface, 'source-address', self.local_v6])
- self.session.set(self._base_path + [interface, 'remote', remote_ip6])
+ self.cli_set(self._base_path + [interface, 'address', local_if_addr])
+ self.cli_set(self._base_path + [interface, 'encapsulation', encapsulation])
+ self.cli_set(self._base_path + [interface, 'source-address', self.local_v6])
+ self.cli_set(self._base_path + [interface, 'remote', remote_ip6])
# Encapsulation mode requires IPv4 source-address
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(self._base_path + [interface, 'source-address', self.local_v4])
+ self.cli_commit()
+ self.cli_set(self._base_path + [interface, 'source-address', self.local_v4])
# Encapsulation mode requires IPv4 remote
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(self._base_path + [interface, 'remote', remote_ip4])
- self.session.set(self._base_path + [interface, 'source-interface', source_if])
+ self.cli_commit()
+ self.cli_set(self._base_path + [interface, 'remote', remote_ip4])
+ self.cli_set(self._base_path + [interface, 'source-interface', source_if])
# Source interface can not be used with sit and gretap
if encapsulation in ['sit', 'gretap']:
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(self._base_path + [interface, 'source-interface'])
+ self.cli_commit()
+ self.cli_delete(self._base_path + [interface, 'source-interface'])
# Check if commit is ok
- self.session.commit()
+ self.cli_commit()
- conf = get_json_iface_options(interface)
+ conf = get_interface_config(interface)
if encapsulation not in ['sit', 'gretap']:
self.assertEqual(source_if, conf['link'])
@@ -96,8 +97,8 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest):
self.assertTrue(conf['linkinfo']['info_data']['pmtudisc'])
# cleanup this instance
- self.session.delete(self._base_path + [interface])
- self.session.commit()
+ self.cli_delete(self._base_path + [interface])
+ self.cli_commit()
def test_ipv6_encapsulations(self):
# When running tests ensure that for certain encapsulation types the
@@ -106,33 +107,33 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest):
interface = f'tun1010'
local_if_addr = f'10.10.200.1/24'
for encapsulation in ['ipip6', 'ip6ip6', 'ip6gre', 'ip6gretap']:
- self.session.set(self._base_path + [interface, 'address', local_if_addr])
- self.session.set(self._base_path + [interface, 'encapsulation', encapsulation])
- self.session.set(self._base_path + [interface, 'source-address', self.local_v4])
- self.session.set(self._base_path + [interface, 'remote', remote_ip4])
+ self.cli_set(self._base_path + [interface, 'address', local_if_addr])
+ self.cli_set(self._base_path + [interface, 'encapsulation', encapsulation])
+ self.cli_set(self._base_path + [interface, 'source-address', self.local_v4])
+ self.cli_set(self._base_path + [interface, 'remote', remote_ip4])
# Encapsulation mode requires IPv6 source-address
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(self._base_path + [interface, 'source-address', self.local_v6])
+ self.cli_commit()
+ self.cli_set(self._base_path + [interface, 'source-address', self.local_v6])
# Encapsulation mode requires IPv6 remote
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(self._base_path + [interface, 'remote', remote_ip6])
+ self.cli_commit()
+ self.cli_set(self._base_path + [interface, 'remote', remote_ip6])
# Configure Tunnel Source interface
- self.session.set(self._base_path + [interface, 'source-interface', source_if])
+ self.cli_set(self._base_path + [interface, 'source-interface', source_if])
# Source interface can not be used with ip6gretap
if encapsulation in ['ip6gretap']:
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(self._base_path + [interface, 'source-interface'])
+ self.cli_commit()
+ self.cli_delete(self._base_path + [interface, 'source-interface'])
# Check if commit is ok
- self.session.commit()
+ self.cli_commit()
- conf = get_json_iface_options(interface)
+ conf = get_interface_config(interface)
if encapsulation not in ['ip6gretap']:
self.assertEqual(source_if, conf['link'])
@@ -152,8 +153,8 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest):
self.assertEqual(remote_ip6, conf['linkinfo']['info_data']['remote'])
# cleanup this instance
- self.session.delete(self._base_path + [interface])
- self.session.commit()
+ self.cli_delete(self._base_path + [interface])
+ self.cli_commit()
def test_tunnel_verify_local_dhcp(self):
# We can not use source-address and dhcp-interface at the same time
@@ -161,19 +162,19 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest):
interface = f'tun1020'
local_if_addr = f'10.0.0.1/24'
- self.session.set(self._base_path + [interface, 'address', local_if_addr])
- self.session.set(self._base_path + [interface, 'encapsulation', 'gre'])
- self.session.set(self._base_path + [interface, 'source-address', self.local_v4])
- self.session.set(self._base_path + [interface, 'remote', remote_ip4])
- self.session.set(self._base_path + [interface, 'dhcp-interface', 'eth0'])
+ self.cli_set(self._base_path + [interface, 'address', local_if_addr])
+ self.cli_set(self._base_path + [interface, 'encapsulation', 'gre'])
+ self.cli_set(self._base_path + [interface, 'source-address', self.local_v4])
+ self.cli_set(self._base_path + [interface, 'remote', remote_ip4])
+ self.cli_set(self._base_path + [interface, 'dhcp-interface', 'eth0'])
# source-address and dhcp-interface can not be used at the same time
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(self._base_path + [interface, 'dhcp-interface'])
+ self.cli_commit()
+ self.cli_delete(self._base_path + [interface, 'dhcp-interface'])
# Check if commit is ok
- self.session.commit()
+ self.cli_commit()
def test_tunnel_parameters_gre(self):
interface = f'tun1030'
@@ -181,18 +182,18 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest):
encapsulation = 'gre'
tos = '20'
- self.session.set(self._base_path + [interface, 'encapsulation', encapsulation])
- self.session.set(self._base_path + [interface, 'source-address', self.local_v4])
- self.session.set(self._base_path + [interface, 'remote', remote_ip4])
+ self.cli_set(self._base_path + [interface, 'encapsulation', encapsulation])
+ self.cli_set(self._base_path + [interface, 'source-address', self.local_v4])
+ self.cli_set(self._base_path + [interface, 'remote', remote_ip4])
- self.session.set(self._base_path + [interface, 'parameters', 'ip', 'no-pmtu-discovery'])
- self.session.set(self._base_path + [interface, 'parameters', 'ip', 'key', gre_key])
- self.session.set(self._base_path + [interface, 'parameters', 'ip', 'tos', tos])
+ self.cli_set(self._base_path + [interface, 'parameters', 'ip', 'no-pmtu-discovery'])
+ self.cli_set(self._base_path + [interface, 'parameters', 'ip', 'key', gre_key])
+ self.cli_set(self._base_path + [interface, 'parameters', 'ip', 'tos', tos])
# Check if commit is ok
- self.session.commit()
+ self.cli_commit()
- conf = get_json_iface_options(interface)
+ conf = get_interface_config(interface)
self.assertEqual(mtu, conf['mtu'])
self.assertEqual(interface, conf['ifname'])
self.assertEqual(encapsulation, conf['linkinfo']['info_kind'])
@@ -207,14 +208,14 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest):
encapsulation = 'gretap'
tos = '20'
- self.session.set(self._base_path + [interface, 'encapsulation', encapsulation])
- self.session.set(self._base_path + [interface, 'source-address', self.local_v4])
- self.session.set(self._base_path + [interface, 'remote', remote_ip4])
+ self.cli_set(self._base_path + [interface, 'encapsulation', encapsulation])
+ self.cli_set(self._base_path + [interface, 'source-address', self.local_v4])
+ self.cli_set(self._base_path + [interface, 'remote', remote_ip4])
# Check if commit is ok
- self.session.commit()
+ self.cli_commit()
- conf = get_json_iface_options(interface)
+ conf = get_interface_config(interface)
self.assertEqual(mtu, conf['mtu'])
self.assertEqual(interface, conf['ifname'])
self.assertEqual(encapsulation, conf['linkinfo']['info_kind'])
@@ -224,12 +225,12 @@ class TunnelInterfaceTest(BasicInterfaceTest.BaseTest):
# Change remote ip address (inc host by 2
new_remote = inc_ip(remote_ip4, 2)
- self.session.set(self._base_path + [interface, 'remote', new_remote])
+ self.cli_set(self._base_path + [interface, 'remote', new_remote])
# Check if commit is ok
- self.session.commit()
+ self.cli_commit()
- conf = get_json_iface_options(interface)
+ conf = get_interface_config(interface)
self.assertEqual(new_remote, conf['linkinfo']['info_data']['remote'])
if __name__ == '__main__':
- unittest.main(verbosity=2, failfast=True)
+ unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_interfaces_vxlan.py b/smoketest/scripts/cli/test_interfaces_vxlan.py
index b66315c5e..7b420cd51 100755
--- a/smoketest/scripts/cli/test_interfaces_vxlan.py
+++ b/smoketest/scripts/cli/test_interfaces_vxlan.py
@@ -18,11 +18,11 @@ import unittest
from vyos.configsession import ConfigSession
from vyos.ifconfig import Interface
-from vyos.util import get_json_iface_options
+from vyos.util import get_interface_config
from base_interfaces_test import BasicInterfaceTest
-class VXLANInterfaceTest(BasicInterfaceTest.BaseTest):
+class VXLANInterfaceTest(BasicInterfaceTest.TestCase):
@classmethod
def setUpClass(cls):
cls._test_ip = True
@@ -35,24 +35,26 @@ class VXLANInterfaceTest(BasicInterfaceTest.BaseTest):
'vxlan30': ['vni 30', 'remote 2001:db8:2000::1', 'source-address 2001:db8:1000::1', 'parameters ipv6 flowlabel 0x1000'],
}
cls._interfaces = list(cls._options)
+ # call base-classes classmethod
+ super(cls, cls).setUpClass()
def test_vxlan_parameters(self):
tos = '40'
ttl = 20
for intf in self._interfaces:
for option in self._options.get(intf, []):
- self.session.set(self._base_path + [intf] + option.split())
+ self.cli_set(self._base_path + [intf] + option.split())
- self.session.set(self._base_path + [intf, 'parameters', 'ip', 'dont-fragment'])
- self.session.set(self._base_path + [intf, 'parameters', 'ip', 'tos', tos])
- self.session.set(self._base_path + [intf, 'parameters', 'ip', 'ttl', str(ttl)])
+ self.cli_set(self._base_path + [intf, 'parameters', 'ip', 'dont-fragment'])
+ self.cli_set(self._base_path + [intf, 'parameters', 'ip', 'tos', tos])
+ self.cli_set(self._base_path + [intf, 'parameters', 'ip', 'ttl', str(ttl)])
ttl += 10
- self.session.commit()
+ self.cli_commit()
ttl = 20
for interface in self._interfaces:
- options = get_json_iface_options(interface)
+ options = get_interface_config(interface)
vni = options['linkinfo']['info_data']['id']
self.assertIn(f'vni {vni}', self._options[interface])
diff --git a/smoketest/scripts/cli/test_interfaces_wireguard.py b/smoketest/scripts/cli/test_interfaces_wireguard.py
index e70324f96..d31ec0332 100755
--- a/smoketest/scripts/cli/test_interfaces_wireguard.py
+++ b/smoketest/scripts/cli/test_interfaces_wireguard.py
@@ -17,8 +17,10 @@
import os
import unittest
-from vyos.configsession import ConfigSession, ConfigSessionError
-from base_interfaces_test import BasicInterfaceTest
+from base_vyostest_shim import VyOSUnitTestSHIM
+from vyos.configsession import ConfigSession
+from vyos.configsession import ConfigSessionError
+
# Generate WireGuard default keypair
if not os.path.isdir('/config/auth/wireguard/default'):
@@ -26,17 +28,15 @@ if not os.path.isdir('/config/auth/wireguard/default'):
base_path = ['interfaces', 'wireguard']
-class WireGuardInterfaceTest(unittest.TestCase):
+class WireGuardInterfaceTest(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
self._test_addr = ['192.0.2.1/26', '192.0.2.255/31', '192.0.2.64/32',
'2001:db8:1::ffff/64', '2001:db8:101::1/112']
self._interfaces = ['wg0', 'wg1']
def tearDown(self):
- self.session.delete(base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_wireguard_peer(self):
# Create WireGuard interfaces with associated peers
@@ -46,19 +46,19 @@ class WireGuardInterfaceTest(unittest.TestCase):
pubkey = 'n6ZZL7ph/QJUJSUUTyu19c77my1dRCDHkMzFQUO9Z3A='
for addr in self._test_addr:
- self.session.set(base_path + [intf, 'address', addr])
+ self.cli_set(base_path + [intf, 'address', addr])
- self.session.set(base_path + [intf, 'peer', peer, 'address', '127.0.0.1'])
- self.session.set(base_path + [intf, 'peer', peer, 'port', '1337'])
+ self.cli_set(base_path + [intf, 'peer', peer, 'address', '127.0.0.1'])
+ self.cli_set(base_path + [intf, 'peer', peer, 'port', '1337'])
# Allow different prefixes to traverse the tunnel
allowed_ips = ['10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16']
for ip in allowed_ips:
- self.session.set(base_path + [intf, 'peer', peer, 'allowed-ips', ip])
+ self.cli_set(base_path + [intf, 'peer', peer, 'allowed-ips', ip])
- self.session.set(base_path + [intf, 'peer', peer, 'preshared-key', psk])
- self.session.set(base_path + [intf, 'peer', peer, 'pubkey', pubkey])
- self.session.commit()
+ self.cli_set(base_path + [intf, 'peer', peer, 'preshared-key', psk])
+ self.cli_set(base_path + [intf, 'peer', peer, 'pubkey', pubkey])
+ self.cli_commit()
self.assertTrue(os.path.isdir(f'/sys/class/net/{intf}'))
@@ -71,26 +71,26 @@ class WireGuardInterfaceTest(unittest.TestCase):
pubkey_1 = 'n1CUsmR0M2LUUsyicBd6blZICwUqqWWHbu4ifZ2/9gk='
pubkey_2 = 'ebFx/1G0ti8tvuZd94sEIosAZZIznX+dBAKG/8DFm0I='
- self.session.set(base_path + [interface, 'address', '172.16.0.1/24'])
+ self.cli_set(base_path + [interface, 'address', '172.16.0.1/24'])
- self.session.set(base_path + [interface, 'peer', 'PEER01', 'pubkey', pubkey_1])
- self.session.set(base_path + [interface, 'peer', 'PEER01', 'port', port])
- self.session.set(base_path + [interface, 'peer', 'PEER01', 'allowed-ips', '10.205.212.10/32'])
- self.session.set(base_path + [interface, 'peer', 'PEER01', 'address', '192.0.2.1'])
+ self.cli_set(base_path + [interface, 'peer', 'PEER01', 'pubkey', pubkey_1])
+ self.cli_set(base_path + [interface, 'peer', 'PEER01', 'port', port])
+ self.cli_set(base_path + [interface, 'peer', 'PEER01', 'allowed-ips', '10.205.212.10/32'])
+ self.cli_set(base_path + [interface, 'peer', 'PEER01', 'address', '192.0.2.1'])
- self.session.set(base_path + [interface, 'peer', 'PEER02', 'pubkey', pubkey_2])
- self.session.set(base_path + [interface, 'peer', 'PEER02', 'port', port])
- self.session.set(base_path + [interface, 'peer', 'PEER02', 'allowed-ips', '10.205.212.11/32'])
- self.session.set(base_path + [interface, 'peer', 'PEER02', 'address', '192.0.2.2'])
+ self.cli_set(base_path + [interface, 'peer', 'PEER02', 'pubkey', pubkey_2])
+ self.cli_set(base_path + [interface, 'peer', 'PEER02', 'port', port])
+ self.cli_set(base_path + [interface, 'peer', 'PEER02', 'allowed-ips', '10.205.212.11/32'])
+ self.cli_set(base_path + [interface, 'peer', 'PEER02', 'address', '192.0.2.2'])
# Commit peers
- self.session.commit()
+ self.cli_commit()
self.assertTrue(os.path.isdir(f'/sys/class/net/{interface}'))
# Delete second peer
- self.session.delete(base_path + [interface, 'peer', 'PEER01'])
- self.session.commit()
+ self.cli_delete(base_path + [interface, 'peer', 'PEER01'])
+ self.cli_commit()
if __name__ == '__main__':
unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_interfaces_wireless.py b/smoketest/scripts/cli/test_interfaces_wireless.py
index 39e8cd5b8..4f539a23c 100755
--- a/smoketest/scripts/cli/test_interfaces_wireless.py
+++ b/smoketest/scripts/cli/test_interfaces_wireless.py
@@ -31,7 +31,7 @@ def get_config_value(interface, key):
tmp = re.findall(f'{key}=+(.*)', tmp)
return tmp[0]
-class WirelessInterfaceTest(BasicInterfaceTest.BaseTest):
+class WirelessInterfaceTest(BasicInterfaceTest.TestCase):
@classmethod
def setUpClass(cls):
cls._test_ip = True
@@ -47,6 +47,8 @@ class WirelessInterfaceTest(BasicInterfaceTest.BaseTest):
'type access-point', 'address 192.0.2.13/30', 'channel 0'],
}
cls._interfaces = list(cls._options)
+ # call base-classes classmethod
+ super(cls, cls).setUpClass()
def test_wireless_add_single_ip_address(self):
# derived method to check if member interfaces are enslaved properly
@@ -67,12 +69,12 @@ class WirelessInterfaceTest(BasicInterfaceTest.BaseTest):
interface = 'wlan0'
ssid = 'ssid'
- self.session.set(self._base_path + [interface, 'ssid', ssid])
- self.session.set(self._base_path + [interface, 'country-code', 'se'])
- self.session.set(self._base_path + [interface, 'type', 'access-point'])
+ self.cli_set(self._base_path + [interface, 'ssid', ssid])
+ self.cli_set(self._base_path + [interface, 'country-code', 'se'])
+ self.cli_set(self._base_path + [interface, 'type', 'access-point'])
# auto-powersave is special
- self.session.set(self._base_path + [interface, 'capabilities', 'ht', 'auto-powersave'])
+ self.cli_set(self._base_path + [interface, 'capabilities', 'ht', 'auto-powersave'])
ht_opt = {
# VyOS CLI option hostapd - ht_capab setting
@@ -88,7 +90,7 @@ class WirelessInterfaceTest(BasicInterfaceTest.BaseTest):
'smps static' : '[SMPS-STATIC]',
}
for key in ht_opt:
- self.session.set(self._base_path + [interface, 'capabilities', 'ht'] + key.split())
+ self.cli_set(self._base_path + [interface, 'capabilities', 'ht'] + key.split())
vht_opt = {
# VyOS CLI option hostapd - ht_capab setting
@@ -105,9 +107,9 @@ class WirelessInterfaceTest(BasicInterfaceTest.BaseTest):
'short-gi 160' : '[SHORT-GI-160]',
}
for key in vht_opt:
- self.session.set(self._base_path + [interface, 'capabilities', 'vht'] + key.split())
+ self.cli_set(self._base_path + [interface, 'capabilities', 'vht'] + key.split())
- self.session.commit()
+ self.cli_commit()
#
# Validate Config
@@ -148,29 +150,29 @@ class WirelessInterfaceTest(BasicInterfaceTest.BaseTest):
mode = 'n'
country = 'de'
- self.session.set(self._base_path + [interface, 'physical-device', phy])
- self.session.set(self._base_path + [interface, 'type', 'access-point'])
- self.session.set(self._base_path + [interface, 'mode', mode])
+ self.cli_set(self._base_path + [interface, 'physical-device', phy])
+ self.cli_set(self._base_path + [interface, 'type', 'access-point'])
+ self.cli_set(self._base_path + [interface, 'mode', mode])
# SSID must be set
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(self._base_path + [interface, 'ssid', ssid])
+ self.cli_commit()
+ self.cli_set(self._base_path + [interface, 'ssid', ssid])
# Channel must be set
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(self._base_path + [interface, 'channel', channel])
+ self.cli_commit()
+ self.cli_set(self._base_path + [interface, 'channel', channel])
# Country-Code must be set
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(self._base_path + [interface, 'country-code', country])
+ self.cli_commit()
+ self.cli_set(self._base_path + [interface, 'country-code', country])
- self.session.set(self._base_path + [interface, 'security', 'wpa', 'mode', 'wpa2'])
- self.session.set(self._base_path + [interface, 'security', 'wpa', 'passphrase', wpa_key])
+ self.cli_set(self._base_path + [interface, 'security', 'wpa', 'mode', 'wpa2'])
+ self.cli_set(self._base_path + [interface, 'security', 'wpa', 'passphrase', wpa_key])
- self.session.commit()
+ self.cli_commit()
#
# Validate Config
@@ -211,13 +213,13 @@ class WirelessInterfaceTest(BasicInterfaceTest.BaseTest):
# We need a bridge where we can hook our access-point interface to
bridge_path = ['interfaces', 'bridge', bridge]
- self.session.set(bridge_path + ['member', 'interface', interface])
+ self.cli_set(bridge_path + ['member', 'interface', interface])
- self.session.set(self._base_path + [interface, 'ssid', ssid])
- self.session.set(self._base_path + [interface, 'country-code', 'se'])
- self.session.set(self._base_path + [interface, 'type', 'access-point'])
+ self.cli_set(self._base_path + [interface, 'ssid', ssid])
+ self.cli_set(self._base_path + [interface, 'country-code', 'se'])
+ self.cli_set(self._base_path + [interface, 'type', 'access-point'])
- self.session.commit()
+ self.cli_commit()
# Check for running process
self.assertTrue(process_named_running('hostapd'))
@@ -228,9 +230,9 @@ class WirelessInterfaceTest(BasicInterfaceTest.BaseTest):
self.assertIn(interface, bridge_members)
- self.session.delete(bridge_path)
- self.session.delete(self._base_path)
- self.session.commit()
+ self.cli_delete(bridge_path)
+ self.cli_delete(self._base_path)
+ self.cli_commit()
if __name__ == '__main__':
check_kmod('mac80211_hwsim')
diff --git a/smoketest/scripts/cli/test_interfaces_wirelessmodem.py b/smoketest/scripts/cli/test_interfaces_wirelessmodem.py
index 023f57305..c36835ea7 100755
--- a/smoketest/scripts/cli/test_interfaces_wirelessmodem.py
+++ b/smoketest/scripts/cli/test_interfaces_wirelessmodem.py
@@ -18,7 +18,10 @@ import os
import unittest
from psutil import process_iter
-from vyos.configsession import ConfigSession, ConfigSessionError
+from base_vyostest_shim import VyOSUnitTestSHIM
+
+from vyos.configsession import ConfigSession
+from vyos.configsession import ConfigSessionError
config_file = '/etc/ppp/peers/{}'
base_path = ['interfaces', 'wirelessmodem']
@@ -30,33 +33,31 @@ def get_config_value(interface, key):
return list(line.split())
return []
-class WWANInterfaceTest(unittest.TestCase):
+class WWANInterfaceTest(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
self._interfaces = ['wlm0', 'wlm1']
def tearDown(self):
- self.session.delete(base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_wwan(self):
for interface in self._interfaces:
- self.session.set(base_path + [interface, 'no-peer-dns'])
- self.session.set(base_path + [interface, 'connect-on-demand'])
+ self.cli_set(base_path + [interface, 'no-peer-dns'])
+ self.cli_set(base_path + [interface, 'connect-on-demand'])
# check validate() - APN must be configure
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(base_path + [interface, 'apn', 'vyos.net'])
+ self.cli_commit()
+ self.cli_set(base_path + [interface, 'apn', 'vyos.net'])
# check validate() - device must be configure
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(base_path + [interface, 'device', 'ttyS0'])
+ self.cli_commit()
+ self.cli_set(base_path + [interface, 'device', 'ttyS0'])
# commit changes
- self.session.commit()
+ self.cli_commit()
# verify configuration file(s)
for interface in self._interfaces:
diff --git a/smoketest/scripts/cli/test_nat.py b/smoketest/scripts/cli/test_nat.py
index b5702d691..0706f234e 100755
--- a/smoketest/scripts/cli/test_nat.py
+++ b/smoketest/scripts/cli/test_nat.py
@@ -19,6 +19,7 @@ import jmespath
import json
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
from vyos.util import cmd
@@ -28,16 +29,15 @@ base_path = ['nat']
src_path = base_path + ['source']
dst_path = base_path + ['destination']
-class TestNAT(unittest.TestCase):
+class TestNAT(VyOSUnitTestSHIM.TestCase):
def setUp(self):
# ensure we can also run this test on a live system - so lets clean
# out the current configuration :)
- self.session = ConfigSession(os.getpid())
- self.session.delete(base_path)
+ self.cli_delete(base_path)
def tearDown(self):
- self.session.delete(base_path)
- self.session.commit()
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_snat(self):
rules = ['100', '110', '120', '130', '200', '210', '220', '230']
@@ -48,15 +48,15 @@ class TestNAT(unittest.TestCase):
# depending of rule order we check either for source address for NAT
# or configured destination address for NAT
if int(rule) < 200:
- self.session.set(src_path + ['rule', rule, 'source', 'address', network])
- self.session.set(src_path + ['rule', rule, 'outbound-interface', outbound_iface_100])
- self.session.set(src_path + ['rule', rule, 'translation', 'address', 'masquerade'])
+ self.cli_set(src_path + ['rule', rule, 'source', 'address', network])
+ self.cli_set(src_path + ['rule', rule, 'outbound-interface', outbound_iface_100])
+ self.cli_set(src_path + ['rule', rule, 'translation', 'address', 'masquerade'])
else:
- self.session.set(src_path + ['rule', rule, 'destination', 'address', network])
- self.session.set(src_path + ['rule', rule, 'outbound-interface', outbound_iface_200])
- self.session.set(src_path + ['rule', rule, 'exclude'])
+ self.cli_set(src_path + ['rule', rule, 'destination', 'address', network])
+ self.cli_set(src_path + ['rule', rule, 'outbound-interface', outbound_iface_200])
+ self.cli_set(src_path + ['rule', rule, 'exclude'])
- self.session.commit()
+ self.cli_commit()
tmp = cmd('sudo nft -j list table nat')
data_json = jmespath.search('nftables[?rule].rule[?chain]', json.loads(tmp))
@@ -98,17 +98,17 @@ class TestNAT(unittest.TestCase):
for rule in rules:
port = f'10{rule}'
- self.session.set(dst_path + ['rule', rule, 'source', 'port', port])
- self.session.set(dst_path + ['rule', rule, 'translation', 'address', '192.0.2.1'])
- self.session.set(dst_path + ['rule', rule, 'translation', 'port', port])
+ self.cli_set(dst_path + ['rule', rule, 'source', 'port', port])
+ self.cli_set(dst_path + ['rule', rule, 'translation', 'address', '192.0.2.1'])
+ self.cli_set(dst_path + ['rule', rule, 'translation', 'port', port])
if int(rule) < 200:
- self.session.set(dst_path + ['rule', rule, 'protocol', inbound_proto_100])
- self.session.set(dst_path + ['rule', rule, 'inbound-interface', inbound_iface_100])
+ self.cli_set(dst_path + ['rule', rule, 'protocol', inbound_proto_100])
+ self.cli_set(dst_path + ['rule', rule, 'inbound-interface', inbound_iface_100])
else:
- self.session.set(dst_path + ['rule', rule, 'protocol', inbound_proto_200])
- self.session.set(dst_path + ['rule', rule, 'inbound-interface', inbound_iface_200])
+ self.cli_set(dst_path + ['rule', rule, 'protocol', inbound_proto_200])
+ self.cli_set(dst_path + ['rule', rule, 'inbound-interface', inbound_iface_200])
- self.session.commit()
+ self.cli_commit()
tmp = cmd('sudo nft -j list table nat')
data_json = jmespath.search('nftables[?rule].rule[?chain]', json.loads(tmp))
@@ -141,31 +141,31 @@ class TestNAT(unittest.TestCase):
def test_snat_required_translation_address(self):
# T2813: Ensure translation address is specified
rule = '5'
- self.session.set(src_path + ['rule', rule, 'source', 'address', '192.0.2.0/24'])
+ self.cli_set(src_path + ['rule', rule, 'source', 'address', '192.0.2.0/24'])
# check validate() - outbound-interface must be defined
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(src_path + ['rule', rule, 'outbound-interface', 'eth0'])
+ self.cli_commit()
+ self.cli_set(src_path + ['rule', rule, 'outbound-interface', 'eth0'])
# check validate() - translation address not specified
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
- self.session.set(src_path + ['rule', rule, 'translation', 'address', 'masquerade'])
- self.session.commit()
+ self.cli_set(src_path + ['rule', rule, 'translation', 'address', 'masquerade'])
+ self.cli_commit()
def test_dnat_negated_addresses(self):
# T3186: negated addresses are not accepted by nftables
rule = '1000'
- self.session.set(dst_path + ['rule', rule, 'destination', 'address', '!192.0.2.1'])
- self.session.set(dst_path + ['rule', rule, 'destination', 'port', '53'])
- self.session.set(dst_path + ['rule', rule, 'inbound-interface', 'eth0'])
- self.session.set(dst_path + ['rule', rule, 'protocol', 'tcp_udp'])
- self.session.set(dst_path + ['rule', rule, 'source', 'address', '!192.0.2.1'])
- self.session.set(dst_path + ['rule', rule, 'translation', 'address', '192.0.2.1'])
- self.session.set(dst_path + ['rule', rule, 'translation', 'port', '53'])
- self.session.commit()
+ self.cli_set(dst_path + ['rule', rule, 'destination', 'address', '!192.0.2.1'])
+ self.cli_set(dst_path + ['rule', rule, 'destination', 'port', '53'])
+ self.cli_set(dst_path + ['rule', rule, 'inbound-interface', 'eth0'])
+ self.cli_set(dst_path + ['rule', rule, 'protocol', 'tcp_udp'])
+ self.cli_set(dst_path + ['rule', rule, 'source', 'address', '!192.0.2.1'])
+ self.cli_set(dst_path + ['rule', rule, 'translation', 'address', '192.0.2.1'])
+ self.cli_set(dst_path + ['rule', rule, 'translation', 'port', '53'])
+ self.cli_commit()
def test_nat_no_rules(self):
# T3206: deleting all rules but keep the direction 'destination' or
@@ -173,9 +173,9 @@ class TestNAT(unittest.TestCase):
#
# Test that both 'nat destination' and 'nat source' nodes can exist
# without any rule
- self.session.set(src_path)
- self.session.set(dst_path)
- self.session.commit()
+ self.cli_set(src_path)
+ self.cli_set(dst_path)
+ self.cli_commit()
if __name__ == '__main__':
diff --git a/smoketest/scripts/cli/test_nat66.py b/smoketest/scripts/cli/test_nat66.py
index 4838fb8d8..dca92c97d 100755
--- a/smoketest/scripts/cli/test_nat66.py
+++ b/smoketest/scripts/cli/test_nat66.py
@@ -19,6 +19,8 @@ import jmespath
import json
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
from vyos.util import cmd
@@ -28,26 +30,25 @@ base_path = ['nat66']
src_path = base_path + ['source']
dst_path = base_path + ['destination']
-class TestNAT66(unittest.TestCase):
+class TestNAT66(VyOSUnitTestSHIM.TestCase):
def setUp(self):
# ensure we can also run this test on a live system - so lets clean
# out the current configuration :)
- self.session = ConfigSession(os.getpid())
- self.session.delete(base_path)
+ self.cli_delete(base_path)
def tearDown(self):
- self.session.delete(base_path)
- self.session.commit()
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_source_nat66(self):
source_prefix = 'fc00::/64'
translation_prefix = 'fc01::/64'
- self.session.set(src_path + ['rule', '1', 'outbound-interface', 'eth1'])
- self.session.set(src_path + ['rule', '1', 'source', 'prefix', source_prefix])
- self.session.set(src_path + ['rule', '1', 'translation', 'address', translation_prefix])
+ self.cli_set(src_path + ['rule', '1', 'outbound-interface', 'eth1'])
+ self.cli_set(src_path + ['rule', '1', 'source', 'prefix', source_prefix])
+ self.cli_set(src_path + ['rule', '1', 'translation', 'address', translation_prefix])
# check validate() - outbound-interface must be defined
- self.session.commit()
+ self.cli_commit()
tmp = cmd('sudo nft -j list table ip6 nat')
data_json = jmespath.search('nftables[?rule].rule[?chain]', json.loads(tmp))
@@ -69,16 +70,16 @@ class TestNAT66(unittest.TestCase):
# check for translation address
self.assertEqual(f'{translation_address}/{translation_mask}', translation_prefix)
self.assertEqual(f'{address}/{mask}', source_prefix)
-
+
def test_source_nat66_address(self):
source_prefix = 'fc00::/64'
translation_address = 'fc00::1'
- self.session.set(src_path + ['rule', '1', 'outbound-interface', 'eth1'])
- self.session.set(src_path + ['rule', '1', 'source', 'prefix', source_prefix])
- self.session.set(src_path + ['rule', '1', 'translation', 'address', translation_address])
+ self.cli_set(src_path + ['rule', '1', 'outbound-interface', 'eth1'])
+ self.cli_set(src_path + ['rule', '1', 'source', 'prefix', source_prefix])
+ self.cli_set(src_path + ['rule', '1', 'translation', 'address', translation_address])
# check validate() - outbound-interface must be defined
- self.session.commit()
+ self.cli_commit()
tmp = cmd('sudo nft -j list table ip6 nat')
data_json = jmespath.search('nftables[?rule].rule[?chain]', json.loads(tmp))
@@ -99,16 +100,16 @@ class TestNAT66(unittest.TestCase):
# check for translation address
self.assertEqual(snat_address, translation_address)
self.assertEqual(f'{address}/{mask}', source_prefix)
-
+
def test_destination_nat66(self):
destination_address = 'fc00::1'
translation_address = 'fc01::1'
- self.session.set(dst_path + ['rule', '1', 'inbound-interface', 'eth1'])
- self.session.set(dst_path + ['rule', '1', 'destination', 'address', destination_address])
- self.session.set(dst_path + ['rule', '1', 'translation', 'address', translation_address])
+ self.cli_set(dst_path + ['rule', '1', 'inbound-interface', 'eth1'])
+ self.cli_set(dst_path + ['rule', '1', 'destination', 'address', destination_address])
+ self.cli_set(dst_path + ['rule', '1', 'translation', 'address', translation_address])
# check validate() - outbound-interface must be defined
- self.session.commit()
+ self.cli_commit()
tmp = cmd('sudo nft -j list table ip6 nat')
data_json = jmespath.search('nftables[?rule].rule[?chain]', json.loads(tmp))
@@ -125,16 +126,16 @@ class TestNAT66(unittest.TestCase):
self.assertEqual(dnat_addr, translation_address)
self.assertEqual(iface, 'eth1')
-
+
def test_destination_nat66_prefix(self):
destination_prefix = 'fc00::/64'
translation_prefix = 'fc01::/64'
- self.session.set(dst_path + ['rule', '1', 'inbound-interface', 'eth1'])
- self.session.set(dst_path + ['rule', '1', 'destination', 'address', destination_prefix])
- self.session.set(dst_path + ['rule', '1', 'translation', 'address', translation_prefix])
+ self.cli_set(dst_path + ['rule', '1', 'inbound-interface', 'eth1'])
+ self.cli_set(dst_path + ['rule', '1', 'destination', 'address', destination_prefix])
+ self.cli_set(dst_path + ['rule', '1', 'translation', 'address', translation_prefix])
# check validate() - outbound-interface must be defined
- self.session.commit()
+ self.cli_commit()
tmp = cmd('sudo nft -j list table ip6 nat')
data_json = jmespath.search('nftables[?rule].rule[?chain]', json.loads(tmp))
@@ -157,19 +158,19 @@ class TestNAT66(unittest.TestCase):
# T2813: Ensure translation address is specified
rule = '5'
source_prefix = 'fc00::/64'
- self.session.set(src_path + ['rule', rule, 'source', 'prefix', source_prefix])
+ self.cli_set(src_path + ['rule', rule, 'source', 'prefix', source_prefix])
# check validate() - outbound-interface must be defined
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(src_path + ['rule', rule, 'outbound-interface', 'eth0'])
+ self.cli_commit()
+ self.cli_set(src_path + ['rule', rule, 'outbound-interface', 'eth0'])
# check validate() - translation address not specified
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
- self.session.set(src_path + ['rule', rule, 'translation', 'address', 'masquerade'])
- self.session.commit()
+ self.cli_set(src_path + ['rule', rule, 'translation', 'address', 'masquerade'])
+ self.cli_commit()
def test_nat66_no_rules(self):
# T3206: deleting all rules but keep the direction 'destination' or
@@ -177,9 +178,9 @@ class TestNAT66(unittest.TestCase):
#
# Test that both 'nat destination' and 'nat source' nodes can exist
# without any rule
- self.session.set(src_path)
- self.session.set(dst_path)
- self.session.commit()
+ self.cli_set(src_path)
+ self.cli_set(dst_path)
+ self.cli_commit()
if __name__ == '__main__':
unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_policy.py b/smoketest/scripts/cli/test_policy.py
index 8efbab7e5..57557af68 100755
--- a/smoketest/scripts/cli/test_policy.py
+++ b/smoketest/scripts/cli/test_policy.py
@@ -14,26 +14,20 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import unittest
-from vyos.util import cmd
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
+from vyos.util import cmd
base_path = ['policy']
-def getFRRconfig(section):
- return cmd(f'vtysh -c "show run" | sed -n "/^{section}/,/^!/p"')
-
-class TestPolicy(unittest.TestCase):
- def setUp(self):
- self.session = ConfigSession(os.getpid())
-
+class TestPolicy(VyOSUnitTestSHIM.TestCase):
def tearDown(self):
- self.session.delete(base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_access_list(self):
acls = {
@@ -101,25 +95,25 @@ class TestPolicy(unittest.TestCase):
for acl, acl_config in acls.items():
path = base_path + ['access-list', acl]
- self.session.set(path + ['description', f'VyOS-ACL-{acl}'])
+ self.cli_set(path + ['description', f'VyOS-ACL-{acl}'])
if 'rule' not in acl_config:
continue
for rule, rule_config in acl_config['rule'].items():
- self.session.set(path + ['rule', rule, 'action', rule_config['action']])
+ self.cli_set(path + ['rule', rule, 'action', rule_config['action']])
for direction in ['source', 'destination']:
if direction in rule_config:
if 'any' in rule_config[direction]:
- self.session.set(path + ['rule', rule, direction, 'any'])
+ self.cli_set(path + ['rule', rule, direction, 'any'])
if 'host' in rule_config[direction]:
- self.session.set(path + ['rule', rule, direction, 'host', rule_config[direction]['host']])
+ self.cli_set(path + ['rule', rule, direction, 'host', rule_config[direction]['host']])
if 'network' in rule_config[direction]:
- self.session.set(path + ['rule', rule, direction, 'network', rule_config[direction]['network']])
- self.session.set(path + ['rule', rule, direction, 'inverse-mask', rule_config[direction]['inverse-mask']])
+ self.cli_set(path + ['rule', rule, direction, 'network', rule_config[direction]['network']])
+ self.cli_set(path + ['rule', rule, direction, 'inverse-mask', rule_config[direction]['inverse-mask']])
- self.session.commit()
+ self.cli_commit()
- config = getFRRconfig('access-list')
+ config = self.getFRRconfig('access-list', end='')
for acl, acl_config in acls.items():
seq = '5'
for rule, rule_config in acl_config['rule'].items():
@@ -190,24 +184,24 @@ class TestPolicy(unittest.TestCase):
for acl, acl_config in acls.items():
path = base_path + ['access-list6', acl]
- self.session.set(path + ['description', f'VyOS-ACL-{acl}'])
+ self.cli_set(path + ['description', f'VyOS-ACL-{acl}'])
if 'rule' not in acl_config:
continue
for rule, rule_config in acl_config['rule'].items():
- self.session.set(path + ['rule', rule, 'action', rule_config['action']])
+ self.cli_set(path + ['rule', rule, 'action', rule_config['action']])
for direction in ['source', 'destination']:
if direction in rule_config:
if 'any' in rule_config[direction]:
- self.session.set(path + ['rule', rule, direction, 'any'])
+ self.cli_set(path + ['rule', rule, direction, 'any'])
if 'network' in rule_config[direction]:
- self.session.set(path + ['rule', rule, direction, 'network', rule_config[direction]['network']])
+ self.cli_set(path + ['rule', rule, direction, 'network', rule_config[direction]['network']])
if 'exact-match' in rule_config[direction]:
- self.session.set(path + ['rule', rule, direction, 'exact-match'])
+ self.cli_set(path + ['rule', rule, direction, 'exact-match'])
- self.session.commit()
+ self.cli_commit()
- config = getFRRconfig('ipv6 access-list')
+ config = self.getFRRconfig('ipv6 access-list', end='')
for acl, acl_config in acls.items():
seq = '5'
for rule, rule_config in acl_config['rule'].items():
@@ -295,19 +289,19 @@ class TestPolicy(unittest.TestCase):
for as_path, as_path_config in test_data.items():
path = base_path + ['as-path-list', as_path]
- self.session.set(path + ['description', f'VyOS-ASPATH-{as_path}'])
+ self.cli_set(path + ['description', f'VyOS-ASPATH-{as_path}'])
if 'rule' not in as_path_config:
continue
for rule, rule_config in as_path_config['rule'].items():
if 'action' in rule_config:
- self.session.set(path + ['rule', rule, 'action', rule_config['action']])
+ self.cli_set(path + ['rule', rule, 'action', rule_config['action']])
if 'regex' in rule_config:
- self.session.set(path + ['rule', rule, 'regex', rule_config['regex']])
+ self.cli_set(path + ['rule', rule, 'regex', rule_config['regex']])
- self.session.commit()
+ self.cli_commit()
- config = getFRRconfig('bgp as-path access-list')
+ config = self.getFRRconfig('bgp as-path access-list', end='')
for as_path, as_path_config in test_data.items():
if 'rule' not in as_path_config:
continue
@@ -353,19 +347,19 @@ class TestPolicy(unittest.TestCase):
for comm_list, comm_list_config in test_data.items():
path = base_path + ['community-list', comm_list]
- self.session.set(path + ['description', f'VyOS-COMM-{comm_list}'])
+ self.cli_set(path + ['description', f'VyOS-COMM-{comm_list}'])
if 'rule' not in comm_list_config:
continue
for rule, rule_config in comm_list_config['rule'].items():
if 'action' in rule_config:
- self.session.set(path + ['rule', rule, 'action', rule_config['action']])
+ self.cli_set(path + ['rule', rule, 'action', rule_config['action']])
if 'regex' in rule_config:
- self.session.set(path + ['rule', rule, 'regex', rule_config['regex']])
+ self.cli_set(path + ['rule', rule, 'regex', rule_config['regex']])
- self.session.commit()
+ self.cli_commit()
- config = getFRRconfig('bgp community-list')
+ config = self.getFRRconfig('bgp community-list', end='')
for comm_list, comm_list_config in test_data.items():
if 'rule' not in comm_list_config:
continue
@@ -413,19 +407,19 @@ class TestPolicy(unittest.TestCase):
for comm_list, comm_list_config in test_data.items():
path = base_path + ['extcommunity-list', comm_list]
- self.session.set(path + ['description', f'VyOS-EXTCOMM-{comm_list}'])
+ self.cli_set(path + ['description', f'VyOS-EXTCOMM-{comm_list}'])
if 'rule' not in comm_list_config:
continue
for rule, rule_config in comm_list_config['rule'].items():
if 'action' in rule_config:
- self.session.set(path + ['rule', rule, 'action', rule_config['action']])
+ self.cli_set(path + ['rule', rule, 'action', rule_config['action']])
if 'regex' in rule_config:
- self.session.set(path + ['rule', rule, 'regex', rule_config['regex']])
+ self.cli_set(path + ['rule', rule, 'regex', rule_config['regex']])
- self.session.commit()
+ self.cli_commit()
- config = getFRRconfig('bgp extcommunity-list')
+ config = self.getFRRconfig('bgp extcommunity-list', end='')
for comm_list, comm_list_config in test_data.items():
if 'rule' not in comm_list_config:
continue
@@ -480,19 +474,19 @@ class TestPolicy(unittest.TestCase):
for comm_list, comm_list_config in test_data.items():
path = base_path + ['large-community-list', comm_list]
- self.session.set(path + ['description', f'VyOS-LARGECOMM-{comm_list}'])
+ self.cli_set(path + ['description', f'VyOS-LARGECOMM-{comm_list}'])
if 'rule' not in comm_list_config:
continue
for rule, rule_config in comm_list_config['rule'].items():
if 'action' in rule_config:
- self.session.set(path + ['rule', rule, 'action', rule_config['action']])
+ self.cli_set(path + ['rule', rule, 'action', rule_config['action']])
if 'regex' in rule_config:
- self.session.set(path + ['rule', rule, 'regex', rule_config['regex']])
+ self.cli_set(path + ['rule', rule, 'regex', rule_config['regex']])
- self.session.commit()
+ self.cli_commit()
- config = getFRRconfig('bgp large-community-list')
+ config = self.getFRRconfig('bgp large-community-list', end='')
for comm_list, comm_list_config in test_data.items():
if 'rule' not in comm_list_config:
continue
@@ -556,23 +550,23 @@ class TestPolicy(unittest.TestCase):
for prefix_list, prefix_list_config in test_data.items():
path = base_path + ['prefix-list', prefix_list]
- self.session.set(path + ['description', f'VyOS-PFX-LIST-{prefix_list}'])
+ self.cli_set(path + ['description', f'VyOS-PFX-LIST-{prefix_list}'])
if 'rule' not in prefix_list_config:
continue
for rule, rule_config in prefix_list_config['rule'].items():
if 'action' in rule_config:
- self.session.set(path + ['rule', rule, 'action', rule_config['action']])
+ self.cli_set(path + ['rule', rule, 'action', rule_config['action']])
if 'prefix' in rule_config:
- self.session.set(path + ['rule', rule, 'prefix', rule_config['prefix']])
+ self.cli_set(path + ['rule', rule, 'prefix', rule_config['prefix']])
if 'ge' in rule_config:
- self.session.set(path + ['rule', rule, 'ge', rule_config['ge']])
+ self.cli_set(path + ['rule', rule, 'ge', rule_config['ge']])
if 'le' in rule_config:
- self.session.set(path + ['rule', rule, 'le', rule_config['le']])
+ self.cli_set(path + ['rule', rule, 'le', rule_config['le']])
- self.session.commit()
+ self.cli_commit()
- config = getFRRconfig('ip prefix-list')
+ config = self.getFRRconfig('ip prefix-list', end='')
for prefix_list, prefix_list_config in test_data.items():
if 'rule' not in prefix_list_config:
continue
@@ -639,23 +633,23 @@ class TestPolicy(unittest.TestCase):
for prefix_list, prefix_list_config in test_data.items():
path = base_path + ['prefix-list6', prefix_list]
- self.session.set(path + ['description', f'VyOS-PFX-LIST-{prefix_list}'])
+ self.cli_set(path + ['description', f'VyOS-PFX-LIST-{prefix_list}'])
if 'rule' not in prefix_list_config:
continue
for rule, rule_config in prefix_list_config['rule'].items():
if 'action' in rule_config:
- self.session.set(path + ['rule', rule, 'action', rule_config['action']])
+ self.cli_set(path + ['rule', rule, 'action', rule_config['action']])
if 'prefix' in rule_config:
- self.session.set(path + ['rule', rule, 'prefix', rule_config['prefix']])
+ self.cli_set(path + ['rule', rule, 'prefix', rule_config['prefix']])
if 'ge' in rule_config:
- self.session.set(path + ['rule', rule, 'ge', rule_config['ge']])
+ self.cli_set(path + ['rule', rule, 'ge', rule_config['ge']])
if 'le' in rule_config:
- self.session.set(path + ['rule', rule, 'le', rule_config['le']])
+ self.cli_set(path + ['rule', rule, 'le', rule_config['le']])
- self.session.commit()
+ self.cli_commit()
- config = getFRRconfig('ipv6 prefix-list')
+ config = self.getFRRconfig('ipv6 prefix-list', end='')
for prefix_list, prefix_list_config in test_data.items():
if 'rule' not in prefix_list_config:
continue
@@ -677,5 +671,32 @@ class TestPolicy(unittest.TestCase):
self.assertIn(tmp, config)
+
+ # Test set table for some sources
+ def test_table_id(self):
+ path = base_path + ['local-route']
+
+ sources = ['203.0.113.1', '203.0.113.2']
+ rule = '50'
+ table = '23'
+ for src in sources:
+ self.cli_set(path + ['rule', rule, 'set', 'table', table])
+ self.cli_set(path + ['rule', rule, 'source', src])
+
+ self.cli_commit()
+
+ # Check generated configuration
+
+ # Expected values
+ original = """
+ 50: from 203.0.113.1 lookup 23
+ 50: from 203.0.113.2 lookup 23
+ """
+ tmp = cmd('ip rule show prio 50')
+ original = original.split()
+ tmp = tmp.split()
+
+ self.assertEqual(tmp, original)
+
if __name__ == '__main__':
unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_policy_local-route.py b/smoketest/scripts/cli/test_policy_local-route.py
deleted file mode 100755
index de1882a65..000000000
--- a/smoketest/scripts/cli/test_policy_local-route.py
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/env python3
-#
-# Copyright (C) 2020 VyOS maintainers and contributors
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 or later as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-import os
-import unittest
-
-from vyos.configsession import ConfigSession
-from vyos.configsession import ConfigSessionError
-from vyos.util import cmd
-from vyos.util import process_named_running
-
-class PolicyLocalRouteTest(unittest.TestCase):
- def setUp(self):
- self.session = ConfigSession(os.getpid())
- self._sources = ['203.0.113.1', '203.0.113.2']
-
- def tearDown(self):
- # Delete all policies
- self.session.delete(['policy', 'local-route'])
- self.session.commit()
- del self.session
-
- # Test set table for some sources
- def test_table_id(self):
- base = ['policy', 'local-route']
- rule = '50'
- table = '23'
- for src in self._sources:
- self.session.set(base + ['rule', rule, 'set', 'table', table])
- self.session.set(base + ['rule', rule, 'source', src])
-
- self.session.commit()
-
- # Check generated configuration
-
- # Expected values
- original = """
- 50: from 203.0.113.1 lookup 23
- 50: from 203.0.113.2 lookup 23
- """
- tmp = cmd('ip rule show prio 50')
- original = original.split()
- tmp = tmp.split()
-
- self.assertEqual(tmp, original)
-
-if __name__ == '__main__':
- unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_protocols_bfd.py b/smoketest/scripts/cli/test_protocols_bfd.py
index 80e5daa7c..a57f8d5f2 100755
--- a/smoketest/scripts/cli/test_protocols_bfd.py
+++ b/smoketest/scripts/cli/test_protocols_bfd.py
@@ -14,12 +14,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
-from vyos.util import cmd
from vyos.util import process_named_running
PROCESS_NAME = 'bfdd'
@@ -67,53 +66,39 @@ profiles = {
},
}
-def getFRRconfig():
- return cmd('vtysh -c "show run" | sed -n "/^bfd/,/^!/p"')
-
-def getBFDPeerconfig(peer):
- return cmd(f'vtysh -c "show run" | sed -n "/^ {peer}/,/^!/p"')
-
-def getBFDProfileconfig(profile):
- return cmd(f'vtysh -c "show run" | sed -n "/^ {profile}/,/^!/p"')
-
-class TestProtocolsBFD(unittest.TestCase):
- def setUp(self):
- self.session = ConfigSession(os.getpid())
-
+class TestProtocolsBFD(VyOSUnitTestSHIM.TestCase):
def tearDown(self):
- self.session.delete(base_path)
- self.session.commit()
- del self.session
-
+ self.cli_delete(base_path)
+ self.cli_commit()
# Check for running process
self.assertTrue(process_named_running(PROCESS_NAME))
def test_bfd_peer(self):
for peer, peer_config in peers.items():
if 'echo_mode' in peer_config:
- self.session.set(base_path + ['peer', peer, 'echo-mode'])
+ self.cli_set(base_path + ['peer', peer, 'echo-mode'])
if 'intv_echo' in peer_config:
- self.session.set(base_path + ['peer', peer, 'interval', 'echo-interval', peer_config["intv_echo"]])
+ self.cli_set(base_path + ['peer', peer, 'interval', 'echo-interval', peer_config["intv_echo"]])
if 'intv_mult' in peer_config:
- self.session.set(base_path + ['peer', peer, 'interval', 'multiplier', peer_config["intv_mult"]])
+ self.cli_set(base_path + ['peer', peer, 'interval', 'multiplier', peer_config["intv_mult"]])
if 'intv_rx' in peer_config:
- self.session.set(base_path + ['peer', peer, 'interval', 'receive', peer_config["intv_rx"]])
+ self.cli_set(base_path + ['peer', peer, 'interval', 'receive', peer_config["intv_rx"]])
if 'intv_tx' in peer_config:
- self.session.set(base_path + ['peer', peer, 'interval', 'transmit', peer_config["intv_tx"]])
+ self.cli_set(base_path + ['peer', peer, 'interval', 'transmit', peer_config["intv_tx"]])
if 'multihop' in peer_config:
- self.session.set(base_path + ['peer', peer, 'multihop'])
+ self.cli_set(base_path + ['peer', peer, 'multihop'])
if 'shutdown' in peer_config:
- self.session.set(base_path + ['peer', peer, 'shutdown'])
+ self.cli_set(base_path + ['peer', peer, 'shutdown'])
if 'source_addr' in peer_config:
- self.session.set(base_path + ['peer', peer, 'source', 'address', peer_config["source_addr"]])
+ self.cli_set(base_path + ['peer', peer, 'source', 'address', peer_config["source_addr"]])
if 'source_intf' in peer_config:
- self.session.set(base_path + ['peer', peer, 'source', 'interface', peer_config["source_intf"]])
+ self.cli_set(base_path + ['peer', peer, 'source', 'interface', peer_config["source_intf"]])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR bgpd configuration
- frrconfig = getFRRconfig()
+ frrconfig = self.getFRRconfig('bfd')
for peer, peer_config in peers.items():
tmp = f'peer {peer}'
if 'multihop' in peer_config:
@@ -124,58 +109,62 @@ class TestProtocolsBFD(unittest.TestCase):
tmp += f' interface {peer_config["source_intf"]}'
self.assertIn(tmp, frrconfig)
- peerconfig = getBFDPeerconfig(tmp)
+ peerconfig = self.getFRRconfig(f' peer {peer}', end='')
if 'echo_mode' in peer_config:
- self.assertIn(f' echo-mode', peerconfig)
+ self.assertIn(f'echo-mode', peerconfig)
if 'intv_echo' in peer_config:
- self.assertIn(f' echo-interval {peer_config["intv_echo"]}', peerconfig)
+ self.assertIn(f'echo-interval {peer_config["intv_echo"]}', peerconfig)
if 'intv_mult' in peer_config:
- self.assertIn(f' detect-multiplier {peer_config["intv_mult"]}', peerconfig)
+ self.assertIn(f'detect-multiplier {peer_config["intv_mult"]}', peerconfig)
if 'intv_rx' in peer_config:
- self.assertIn(f' receive-interval {peer_config["intv_rx"]}', peerconfig)
+ self.assertIn(f'receive-interval {peer_config["intv_rx"]}', peerconfig)
if 'intv_tx' in peer_config:
- self.assertIn(f' transmit-interval {peer_config["intv_tx"]}', peerconfig)
- if 'shutdown' not in peer_config:
- self.assertIn(f' no shutdown', peerconfig)
+ self.assertIn(f'transmit-interval {peer_config["intv_tx"]}', peerconfig)
+ if 'shutdown' in peer_config:
+ self.assertIn(f'shutdown', peerconfig)
+ else:
+ self.assertNotIn(f'shutdown', peerconfig)
def test_bfd_profile(self):
peer = '192.0.2.10'
for profile, profile_config in profiles.items():
if 'echo_mode' in profile_config:
- self.session.set(base_path + ['profile', profile, 'echo-mode'])
+ self.cli_set(base_path + ['profile', profile, 'echo-mode'])
if 'intv_echo' in profile_config:
- self.session.set(base_path + ['profile', profile, 'interval', 'echo-interval', profile_config["intv_echo"]])
+ self.cli_set(base_path + ['profile', profile, 'interval', 'echo-interval', profile_config["intv_echo"]])
if 'intv_mult' in profile_config:
- self.session.set(base_path + ['profile', profile, 'interval', 'multiplier', profile_config["intv_mult"]])
+ self.cli_set(base_path + ['profile', profile, 'interval', 'multiplier', profile_config["intv_mult"]])
if 'intv_rx' in profile_config:
- self.session.set(base_path + ['profile', profile, 'interval', 'receive', profile_config["intv_rx"]])
+ self.cli_set(base_path + ['profile', profile, 'interval', 'receive', profile_config["intv_rx"]])
if 'intv_tx' in profile_config:
- self.session.set(base_path + ['profile', profile, 'interval', 'transmit', profile_config["intv_tx"]])
+ self.cli_set(base_path + ['profile', profile, 'interval', 'transmit', profile_config["intv_tx"]])
if 'shutdown' in profile_config:
- self.session.set(base_path + ['profile', profile, 'shutdown'])
+ self.cli_set(base_path + ['profile', profile, 'shutdown'])
- self.session.set(base_path + ['peer', peer, 'profile', list(profiles)[0]])
+ self.cli_set(base_path + ['peer', peer, 'profile', list(profiles)[0]])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR bgpd configuration
for profile, profile_config in profiles.items():
- config = getBFDProfileconfig(f'profile {profile}')
+ config = self.getFRRconfig(f' profile {profile}', endsection='^ !')
if 'echo_mode' in profile_config:
- self.assertIn(f' echo-mode', config)
+ self.assertIn(f'echo-mode', config)
if 'intv_echo' in profile_config:
- self.assertIn(f' echo-interval {profile_config["intv_echo"]}', config)
+ self.assertIn(f'echo-interval {profile_config["intv_echo"]}', config)
if 'intv_mult' in profile_config:
- self.assertIn(f' detect-multiplier {profile_config["intv_mult"]}', config)
+ self.assertIn(f'detect-multiplier {profile_config["intv_mult"]}', config)
if 'intv_rx' in profile_config:
- self.assertIn(f' receive-interval {profile_config["intv_rx"]}', config)
+ self.assertIn(f'receive-interval {profile_config["intv_rx"]}', config)
if 'intv_tx' in profile_config:
- self.assertIn(f' transmit-interval {profile_config["intv_tx"]}', config)
- if 'shutdown' not in profile_config:
- self.assertIn(f' no shutdown', config)
+ self.assertIn(f'transmit-interval {profile_config["intv_tx"]}', config)
+ if 'shutdown' in profile_config:
+ self.assertIn(f'shutdown', config)
+ else:
+ self.assertNotIn(f'shutdown', config)
if __name__ == '__main__':
unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_protocols_bgp.py b/smoketest/scripts/cli/test_protocols_bgp.py
index 9aa1541cf..4f39948c0 100755
--- a/smoketest/scripts/cli/test_protocols_bgp.py
+++ b/smoketest/scripts/cli/test_protocols_bgp.py
@@ -14,18 +14,17 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import unittest
-from vyos.configsession import ConfigSession
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSessionError
from vyos.template import is_ipv6
-from vyos.util import cmd
from vyos.util import process_named_running
PROCESS_NAME = 'bgpd'
ASN = '64512'
-base_path = ['protocols', 'bgp', ASN]
+base_path = ['protocols', 'bgp']
route_map_in = 'foo-map-in'
route_map_out = 'foo-map-out'
@@ -128,45 +127,31 @@ peer_group_config = {
},
}
-def getFRRBGPconfig():
- return cmd(f'vtysh -c "show run" | sed -n "/^router bgp {ASN}/,/^!/p"')
-
-def getFRRBgpAfiConfig(afi):
- return cmd(f'vtysh -c "show run" | sed -n "/^router bgp {ASN}/,/^!/p" | sed -n "/^ address-family {afi} unicast/,/^ exit-address-family/p"')
-
-def getFRRBGPVNIconfig(vni):
- return cmd(f'vtysh -c "show run" | sed -n "/^ vni {vni}/,/^!/p"')
-def getFRRRPKIconfig():
- return cmd(f'vtysh -c "show run" | sed -n "/^rpki/,/^!/p"')
-
-class TestProtocolsBGP(unittest.TestCase):
+class TestProtocolsBGP(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
-
- self.session.set(['policy', 'route-map', route_map_in, 'rule', '10', 'action', 'permit'])
- self.session.set(['policy', 'route-map', route_map_out, 'rule', '10', 'action', 'permit'])
- self.session.set(['policy', 'prefix-list', prefix_list_in, 'rule', '10', 'action', 'permit'])
- self.session.set(['policy', 'prefix-list', prefix_list_in, 'rule', '10', 'prefix', '192.0.2.0/25'])
- self.session.set(['policy', 'prefix-list', prefix_list_out, 'rule', '10', 'action', 'permit'])
- self.session.set(['policy', 'prefix-list', prefix_list_out, 'rule', '10', 'prefix', '192.0.2.128/25'])
-
- self.session.set(['policy', 'prefix-list6', prefix_list_in6, 'rule', '10', 'action', 'permit'])
- self.session.set(['policy', 'prefix-list6', prefix_list_in6, 'rule', '10', 'prefix', '2001:db8:1000::/64'])
- self.session.set(['policy', 'prefix-list6', prefix_list_out6, 'rule', '10', 'action', 'deny'])
- self.session.set(['policy', 'prefix-list6', prefix_list_out6, 'rule', '10', 'prefix', '2001:db8:2000::/64'])
+ self.cli_set(['policy', 'route-map', route_map_in, 'rule', '10', 'action', 'permit'])
+ self.cli_set(['policy', 'route-map', route_map_out, 'rule', '10', 'action', 'permit'])
+ self.cli_set(['policy', 'prefix-list', prefix_list_in, 'rule', '10', 'action', 'permit'])
+ self.cli_set(['policy', 'prefix-list', prefix_list_in, 'rule', '10', 'prefix', '192.0.2.0/25'])
+ self.cli_set(['policy', 'prefix-list', prefix_list_out, 'rule', '10', 'action', 'permit'])
+ self.cli_set(['policy', 'prefix-list', prefix_list_out, 'rule', '10', 'prefix', '192.0.2.128/25'])
+
+ self.cli_set(['policy', 'prefix-list6', prefix_list_in6, 'rule', '10', 'action', 'permit'])
+ self.cli_set(['policy', 'prefix-list6', prefix_list_in6, 'rule', '10', 'prefix', '2001:db8:1000::/64'])
+ self.cli_set(['policy', 'prefix-list6', prefix_list_out6, 'rule', '10', 'action', 'deny'])
+ self.cli_set(['policy', 'prefix-list6', prefix_list_out6, 'rule', '10', 'prefix', '2001:db8:2000::/64'])
def tearDown(self):
- self.session.delete(['policy', 'route-map', route_map_in])
- self.session.delete(['policy', 'route-map', route_map_out])
- self.session.delete(['policy', 'prefix-list', prefix_list_in])
- self.session.delete(['policy', 'prefix-list', prefix_list_out])
- self.session.delete(['policy', 'prefix-list6', prefix_list_in6])
- self.session.delete(['policy', 'prefix-list6', prefix_list_out6])
+ self.cli_delete(['policy', 'route-map', route_map_in])
+ self.cli_delete(['policy', 'route-map', route_map_out])
+ self.cli_delete(['policy', 'prefix-list', prefix_list_in])
+ self.cli_delete(['policy', 'prefix-list', prefix_list_out])
+ self.cli_delete(['policy', 'prefix-list6', prefix_list_in6])
+ self.cli_delete(['policy', 'prefix-list6', prefix_list_out6])
- self.session.delete(base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(base_path)
+ self.cli_commit()
# Check for running process
self.assertTrue(process_named_running(PROCESS_NAME))
@@ -226,27 +211,33 @@ class TestProtocolsBGP(unittest.TestCase):
max_path_v6 = '8'
max_path_v6ibgp = '16'
- self.session.set(base_path + ['parameters', 'router-id', router_id])
- self.session.set(base_path + ['parameters', 'log-neighbor-changes'])
+ self.cli_set(base_path + ['parameters', 'router-id', router_id])
+ self.cli_set(base_path + ['parameters', 'log-neighbor-changes'])
+
+ # Local AS number MUST be defined
+ with self.assertRaises(ConfigSessionError):
+ self.cli_commit()
+ self.cli_set(base_path + ['local-as', ASN])
+
# Default local preference (higher = more preferred, default value is 100)
- self.session.set(base_path + ['parameters', 'default', 'local-pref', local_pref])
+ self.cli_set(base_path + ['parameters', 'default', 'local-pref', local_pref])
# Deactivate IPv4 unicast for a peer by default
- self.session.set(base_path + ['parameters', 'default', 'no-ipv4-unicast'])
- self.session.set(base_path + ['parameters', 'graceful-restart', 'stalepath-time', stalepath_time])
- self.session.set(base_path + ['parameters', 'graceful-shutdown'])
- self.session.set(base_path + ['parameters', 'ebgp-requires-policy'])
+ self.cli_set(base_path + ['parameters', 'default', 'no-ipv4-unicast'])
+ self.cli_set(base_path + ['parameters', 'graceful-restart', 'stalepath-time', stalepath_time])
+ self.cli_set(base_path + ['parameters', 'graceful-shutdown'])
+ self.cli_set(base_path + ['parameters', 'ebgp-requires-policy'])
# AFI maximum path support
- self.session.set(base_path + ['address-family', 'ipv4-unicast', 'maximum-paths', 'ebgp', max_path_v4])
- self.session.set(base_path + ['address-family', 'ipv4-unicast', 'maximum-paths', 'ibgp', max_path_v4ibgp])
- self.session.set(base_path + ['address-family', 'ipv6-unicast', 'maximum-paths', 'ebgp', max_path_v6])
- self.session.set(base_path + ['address-family', 'ipv6-unicast', 'maximum-paths', 'ibgp', max_path_v6ibgp])
+ self.cli_set(base_path + ['address-family', 'ipv4-unicast', 'maximum-paths', 'ebgp', max_path_v4])
+ self.cli_set(base_path + ['address-family', 'ipv4-unicast', 'maximum-paths', 'ibgp', max_path_v4ibgp])
+ self.cli_set(base_path + ['address-family', 'ipv6-unicast', 'maximum-paths', 'ebgp', max_path_v6])
+ self.cli_set(base_path + ['address-family', 'ipv6-unicast', 'maximum-paths', 'ibgp', max_path_v6ibgp])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR bgpd configuration
- frrconfig = getFRRBGPconfig()
+ frrconfig = self.getFRRconfig(f'router bgp {ASN}')
self.assertIn(f'router bgp {ASN}', frrconfig)
self.assertIn(f' bgp router-id {router_id}', frrconfig)
self.assertIn(f' bgp log-neighbor-changes', frrconfig)
@@ -256,16 +247,17 @@ class TestProtocolsBGP(unittest.TestCase):
self.assertIn(f' bgp graceful-shutdown', frrconfig)
self.assertNotIn(f'bgp ebgp-requires-policy', frrconfig)
- afiv4_config = getFRRBgpAfiConfig('ipv4')
+ afiv4_config = self.getFRRconfig(' address-family ipv4 unicast')
self.assertIn(f' maximum-paths {max_path_v4}', afiv4_config)
self.assertIn(f' maximum-paths ibgp {max_path_v4ibgp}', afiv4_config)
- afiv6_config = getFRRBgpAfiConfig('ipv6')
+ afiv6_config = self.getFRRconfig(' address-family ipv6 unicast')
self.assertIn(f' maximum-paths {max_path_v6}', afiv6_config)
self.assertIn(f' maximum-paths ibgp {max_path_v6ibgp}', afiv6_config)
def test_bgp_02_neighbors(self):
+ self.cli_set(base_path + ['local-as', ASN])
# Test out individual neighbor configuration items, not all of them are
# also available to a peer-group!
for peer, peer_config in neighbor_config.items():
@@ -274,59 +266,59 @@ class TestProtocolsBGP(unittest.TestCase):
afi = 'ipv6-unicast'
if 'adv_interv' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'advertisement-interval', peer_config["adv_interv"]])
+ self.cli_set(base_path + ['neighbor', peer, 'advertisement-interval', peer_config["adv_interv"]])
if 'cap_dynamic' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'capability', 'dynamic'])
+ self.cli_set(base_path + ['neighbor', peer, 'capability', 'dynamic'])
if 'cap_ext_next' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'capability', 'extended-nexthop'])
+ self.cli_set(base_path + ['neighbor', peer, 'capability', 'extended-nexthop'])
if 'description' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'description', peer_config["description"]])
+ self.cli_set(base_path + ['neighbor', peer, 'description', peer_config["description"]])
if 'no_cap_nego' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'disable-capability-negotiation'])
+ self.cli_set(base_path + ['neighbor', peer, 'disable-capability-negotiation'])
if 'multi_hop' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'ebgp-multihop', peer_config["multi_hop"]])
+ self.cli_set(base_path + ['neighbor', peer, 'ebgp-multihop', peer_config["multi_hop"]])
if 'local_as' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'local-as', peer_config["local_as"]])
+ self.cli_set(base_path + ['neighbor', peer, 'local-as', peer_config["local_as"]])
if 'cap_over' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'override-capability'])
+ self.cli_set(base_path + ['neighbor', peer, 'override-capability'])
if 'passive' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'passive'])
+ self.cli_set(base_path + ['neighbor', peer, 'passive'])
if 'password' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'password', peer_config["password"]])
+ self.cli_set(base_path + ['neighbor', peer, 'password', peer_config["password"]])
if 'port' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'port', peer_config["port"]])
+ self.cli_set(base_path + ['neighbor', peer, 'port', peer_config["port"]])
if 'remote_as' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'remote-as', peer_config["remote_as"]])
+ self.cli_set(base_path + ['neighbor', peer, 'remote-as', peer_config["remote_as"]])
if 'cap_strict' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'strict-capability-match'])
+ self.cli_set(base_path + ['neighbor', peer, 'strict-capability-match'])
if 'shutdown' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'shutdown'])
+ self.cli_set(base_path + ['neighbor', peer, 'shutdown'])
if 'ttl_security' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'ttl-security', 'hops', peer_config["ttl_security"]])
+ self.cli_set(base_path + ['neighbor', peer, 'ttl-security', 'hops', peer_config["ttl_security"]])
if 'update_src' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'update-source', peer_config["update_src"]])
+ self.cli_set(base_path + ['neighbor', peer, 'update-source', peer_config["update_src"]])
if 'route_map_in' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'address-family', afi, 'route-map', 'import', peer_config["route_map_in"]])
+ self.cli_set(base_path + ['neighbor', peer, 'address-family', afi, 'route-map', 'import', peer_config["route_map_in"]])
if 'route_map_out' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'address-family', afi, 'route-map', 'export', peer_config["route_map_out"]])
+ self.cli_set(base_path + ['neighbor', peer, 'address-family', afi, 'route-map', 'export', peer_config["route_map_out"]])
if 'pfx_list_in' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'address-family', afi, 'prefix-list', 'import', peer_config["pfx_list_in"]])
+ self.cli_set(base_path + ['neighbor', peer, 'address-family', afi, 'prefix-list', 'import', peer_config["pfx_list_in"]])
if 'pfx_list_out' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'address-family', afi, 'prefix-list', 'export', peer_config["pfx_list_out"]])
+ self.cli_set(base_path + ['neighbor', peer, 'address-family', afi, 'prefix-list', 'export', peer_config["pfx_list_out"]])
if 'no_send_comm_std' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'address-family', afi, 'disable-send-community', 'standard'])
+ self.cli_set(base_path + ['neighbor', peer, 'address-family', afi, 'disable-send-community', 'standard'])
if 'no_send_comm_ext' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'address-family', afi, 'disable-send-community', 'extended'])
+ self.cli_set(base_path + ['neighbor', peer, 'address-family', afi, 'disable-send-community', 'extended'])
if 'addpath_all' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'address-family', afi, 'addpath-tx-all'])
+ self.cli_set(base_path + ['neighbor', peer, 'address-family', afi, 'addpath-tx-all'])
if 'addpath_per_as' in peer_config:
- self.session.set(base_path + ['neighbor', peer, 'address-family', afi, 'addpath-tx-per-as'])
+ self.cli_set(base_path + ['neighbor', peer, 'address-family', afi, 'addpath-tx-per-as'])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR bgpd configuration
- frrconfig = getFRRBGPconfig()
+ frrconfig = self.getFRRconfig(f'router bgp {ASN}')
self.assertIn(f'router bgp {ASN}', frrconfig)
for peer, peer_config in neighbor_config.items():
@@ -340,56 +332,57 @@ class TestProtocolsBGP(unittest.TestCase):
self.verify_frr_config(peer, peer_config, frrconfig)
def test_bgp_03_peer_groups(self):
+ self.cli_set(base_path + ['local-as', ASN])
# Test out individual peer-group configuration items
for peer_group, config in peer_group_config.items():
if 'cap_dynamic' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'capability', 'dynamic'])
+ self.cli_set(base_path + ['peer-group', peer_group, 'capability', 'dynamic'])
if 'cap_ext_next' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'capability', 'extended-nexthop'])
+ self.cli_set(base_path + ['peer-group', peer_group, 'capability', 'extended-nexthop'])
if 'description' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'description', config["description"]])
+ self.cli_set(base_path + ['peer-group', peer_group, 'description', config["description"]])
if 'no_cap_nego' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'disable-capability-negotiation'])
+ self.cli_set(base_path + ['peer-group', peer_group, 'disable-capability-negotiation'])
if 'multi_hop' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'ebgp-multihop', config["multi_hop"]])
+ self.cli_set(base_path + ['peer-group', peer_group, 'ebgp-multihop', config["multi_hop"]])
if 'local_as' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'local-as', config["local_as"]])
+ self.cli_set(base_path + ['peer-group', peer_group, 'local-as', config["local_as"]])
if 'cap_over' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'override-capability'])
+ self.cli_set(base_path + ['peer-group', peer_group, 'override-capability'])
if 'passive' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'passive'])
+ self.cli_set(base_path + ['peer-group', peer_group, 'passive'])
if 'password' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'password', config["password"]])
+ self.cli_set(base_path + ['peer-group', peer_group, 'password', config["password"]])
if 'remote_as' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'remote-as', config["remote_as"]])
+ self.cli_set(base_path + ['peer-group', peer_group, 'remote-as', config["remote_as"]])
if 'shutdown' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'shutdown'])
+ self.cli_set(base_path + ['peer-group', peer_group, 'shutdown'])
if 'ttl_security' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'ttl-security', 'hops', config["ttl_security"]])
+ self.cli_set(base_path + ['peer-group', peer_group, 'ttl-security', 'hops', config["ttl_security"]])
if 'update_src' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'update-source', config["update_src"]])
+ self.cli_set(base_path + ['peer-group', peer_group, 'update-source', config["update_src"]])
if 'route_map_in' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'address-family', 'ipv4-unicast', 'route-map', 'import', config["route_map_in"]])
+ self.cli_set(base_path + ['peer-group', peer_group, 'address-family', 'ipv4-unicast', 'route-map', 'import', config["route_map_in"]])
if 'route_map_out' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'address-family', 'ipv4-unicast', 'route-map', 'export', config["route_map_out"]])
+ self.cli_set(base_path + ['peer-group', peer_group, 'address-family', 'ipv4-unicast', 'route-map', 'export', config["route_map_out"]])
if 'pfx_list_in' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'address-family', 'ipv4-unicast', 'prefix-list', 'import', config["pfx_list_in"]])
+ self.cli_set(base_path + ['peer-group', peer_group, 'address-family', 'ipv4-unicast', 'prefix-list', 'import', config["pfx_list_in"]])
if 'pfx_list_out' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'address-family', 'ipv4-unicast', 'prefix-list', 'export', config["pfx_list_out"]])
+ self.cli_set(base_path + ['peer-group', peer_group, 'address-family', 'ipv4-unicast', 'prefix-list', 'export', config["pfx_list_out"]])
if 'no_send_comm_std' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'address-family', 'ipv4-unicast', 'disable-send-community', 'standard'])
+ self.cli_set(base_path + ['peer-group', peer_group, 'address-family', 'ipv4-unicast', 'disable-send-community', 'standard'])
if 'no_send_comm_ext' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'address-family', 'ipv4-unicast', 'disable-send-community', 'extended'])
+ self.cli_set(base_path + ['peer-group', peer_group, 'address-family', 'ipv4-unicast', 'disable-send-community', 'extended'])
if 'addpath_all' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'address-family', 'ipv4-unicast', 'addpath-tx-all'])
+ self.cli_set(base_path + ['peer-group', peer_group, 'address-family', 'ipv4-unicast', 'addpath-tx-all'])
if 'addpath_per_as' in config:
- self.session.set(base_path + ['peer-group', peer_group, 'address-family', 'ipv4-unicast', 'addpath-tx-per-as'])
+ self.cli_set(base_path + ['peer-group', peer_group, 'address-family', 'ipv4-unicast', 'addpath-tx-per-as'])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR bgpd configuration
- frrconfig = getFRRBGPconfig()
+ frrconfig = self.getFRRconfig(f'router bgp {ASN}')
self.assertIn(f'router bgp {ASN}', frrconfig)
for peer, peer_config in peer_group_config.items():
@@ -410,27 +403,29 @@ class TestProtocolsBGP(unittest.TestCase):
},
}
+ self.cli_set(base_path + ['local-as', ASN])
+
# We want to redistribute ...
redistributes = ['connected', 'isis', 'kernel', 'ospf', 'rip', 'static']
for redistribute in redistributes:
- self.session.set(base_path + ['address-family', 'ipv4-unicast',
+ self.cli_set(base_path + ['address-family', 'ipv4-unicast',
'redistribute', redistribute])
for network, network_config in networks.items():
- self.session.set(base_path + ['address-family', 'ipv4-unicast',
+ self.cli_set(base_path + ['address-family', 'ipv4-unicast',
'network', network])
if 'as_set' in network_config:
- self.session.set(base_path + ['address-family', 'ipv4-unicast',
+ self.cli_set(base_path + ['address-family', 'ipv4-unicast',
'aggregate-address', network, 'as-set'])
if 'summary_only' in network_config:
- self.session.set(base_path + ['address-family', 'ipv4-unicast',
+ self.cli_set(base_path + ['address-family', 'ipv4-unicast',
'aggregate-address', network, 'summary-only'])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR bgpd configuration
- frrconfig = getFRRBGPconfig()
+ frrconfig = self.getFRRconfig(f'router bgp {ASN}')
self.assertIn(f'router bgp {ASN}', frrconfig)
self.assertIn(f' address-family ipv4 unicast', frrconfig)
@@ -456,24 +451,26 @@ class TestProtocolsBGP(unittest.TestCase):
},
}
+ self.cli_set(base_path + ['local-as', ASN])
+
# We want to redistribute ...
redistributes = ['connected', 'kernel', 'ospfv3', 'ripng', 'static']
for redistribute in redistributes:
- self.session.set(base_path + ['address-family', 'ipv6-unicast',
+ self.cli_set(base_path + ['address-family', 'ipv6-unicast',
'redistribute', redistribute])
for network, network_config in networks.items():
- self.session.set(base_path + ['address-family', 'ipv6-unicast',
+ self.cli_set(base_path + ['address-family', 'ipv6-unicast',
'network', network])
if 'summary_only' in network_config:
- self.session.set(base_path + ['address-family', 'ipv6-unicast',
+ self.cli_set(base_path + ['address-family', 'ipv6-unicast',
'aggregate-address', network, 'summary-only'])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR bgpd configuration
- frrconfig = getFRRBGPconfig()
+ frrconfig = self.getFRRconfig(f'router bgp {ASN}')
self.assertIn(f'router bgp {ASN}', frrconfig)
self.assertIn(f' address-family ipv6 unicast', frrconfig)
# T2100: By default ebgp-requires-policy is disabled to keep VyOS
@@ -497,24 +494,27 @@ class TestProtocolsBGP(unittest.TestCase):
limit = '64'
listen_ranges = ['192.0.2.0/25', '192.0.2.128/25']
peer_group = 'listenfoobar'
- self.session.set(base_path + ['listen', 'limit', limit])
+
+ self.cli_set(base_path + ['local-as', ASN])
+ self.cli_set(base_path + ['listen', 'limit', limit])
+
for prefix in listen_ranges:
- self.session.set(base_path + ['listen', 'range', prefix])
+ self.cli_set(base_path + ['listen', 'range', prefix])
# check validate() - peer-group must be defined for range/prefix
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(base_path + ['listen', 'range', prefix, 'peer-group', peer_group])
+ self.cli_commit()
+ self.cli_set(base_path + ['listen', 'range', prefix, 'peer-group', peer_group])
# check validate() - peer-group does yet not exist!
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(base_path + ['peer-group', peer_group, 'remote-as', ASN])
+ self.cli_commit()
+ self.cli_set(base_path + ['peer-group', peer_group, 'remote-as', ASN])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR bgpd configuration
- frrconfig = getFRRBGPconfig()
+ frrconfig = self.getFRRconfig(f'router bgp {ASN}')
self.assertIn(f'router bgp {ASN}', frrconfig)
self.assertIn(f' neighbor {peer_group} peer-group', frrconfig)
self.assertIn(f' neighbor {peer_group} remote-as {ASN}', frrconfig)
@@ -526,19 +526,22 @@ class TestProtocolsBGP(unittest.TestCase):
def test_bgp_07_l2vpn_evpn(self):
vnis = ['10010', '10020', '10030']
neighbors = ['192.0.2.10', '192.0.2.20', '192.0.2.30']
- self.session.set(base_path + ['address-family', 'l2vpn-evpn', 'advertise-all-vni'])
- self.session.set(base_path + ['address-family', 'l2vpn-evpn', 'advertise-default-gw'])
- self.session.set(base_path + ['address-family', 'l2vpn-evpn', 'advertise-svi-ip'])
- self.session.set(base_path + ['address-family', 'l2vpn-evpn', 'flooding', 'disable'])
+
+ self.cli_set(base_path + ['local-as', ASN])
+
+ self.cli_set(base_path + ['address-family', 'l2vpn-evpn', 'advertise-all-vni'])
+ self.cli_set(base_path + ['address-family', 'l2vpn-evpn', 'advertise-default-gw'])
+ self.cli_set(base_path + ['address-family', 'l2vpn-evpn', 'advertise-svi-ip'])
+ self.cli_set(base_path + ['address-family', 'l2vpn-evpn', 'flooding', 'disable'])
for vni in vnis:
- self.session.set(base_path + ['address-family', 'l2vpn-evpn', 'vni', vni, 'advertise-default-gw'])
- self.session.set(base_path + ['address-family', 'l2vpn-evpn', 'vni', vni, 'advertise-svi-ip'])
+ self.cli_set(base_path + ['address-family', 'l2vpn-evpn', 'vni', vni, 'advertise-default-gw'])
+ self.cli_set(base_path + ['address-family', 'l2vpn-evpn', 'vni', vni, 'advertise-svi-ip'])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR bgpd configuration
- frrconfig = getFRRBGPconfig()
+ frrconfig = self.getFRRconfig(f'router bgp {ASN}')
self.assertIn(f'router bgp {ASN}', frrconfig)
self.assertIn(f' address-family l2vpn evpn', frrconfig)
self.assertIn(f' advertise-all-vni', frrconfig)
@@ -546,10 +549,35 @@ class TestProtocolsBGP(unittest.TestCase):
self.assertIn(f' advertise-svi-ip', frrconfig)
self.assertIn(f' flooding disable', frrconfig)
for vni in vnis:
- vniconfig = getFRRBGPVNIconfig(vni)
+ vniconfig = self.getFRRconfig(f' vni {vni}')
self.assertIn(f'vni {vni}', vniconfig)
self.assertIn(f' advertise-default-gw', vniconfig)
self.assertIn(f' advertise-svi-ip', vniconfig)
+ def test_bgp_08_vrf_simple(self):
+ router_id = '127.0.0.3'
+ vrfs = ['red', 'green', 'blue']
+
+ # It is safe to assume that when the basic VRF test works, all
+ # other BGP related features work, as we entirely inherit the CLI
+ # templates and Jinja2 FRR template.
+ table = '1000'
+
+ for vrf in vrfs:
+ vrf_base = ['vrf', 'name', vrf]
+ self.cli_set(vrf_base + ['table', table])
+ self.cli_set(vrf_base + ['protocols', 'bgp', 'local-as', ASN])
+ self.cli_set(vrf_base + ['protocols', 'bgp', 'parameters', 'router-id', router_id])
+ table = str(int(table) + 1000)
+
+ self.cli_commit()
+
+ for vrf in vrfs:
+ # Verify FRR bgpd configuration
+ frrconfig = self.getFRRconfig(f'router bgp {ASN} vrf {vrf}')
+
+ self.assertIn(f'router bgp {ASN} vrf {vrf}', frrconfig)
+ self.assertIn(f' bgp router-id {router_id}', frrconfig)
+
if __name__ == '__main__':
unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_protocols_igmp-proxy.py b/smoketest/scripts/cli/test_protocols_igmp-proxy.py
index 6aaad739d..1eaf21722 100755
--- a/smoketest/scripts/cli/test_protocols_igmp-proxy.py
+++ b/smoketest/scripts/cli/test_protocols_igmp-proxy.py
@@ -14,9 +14,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
from vyos.util import read_file
@@ -28,46 +29,44 @@ base_path = ['protocols', 'igmp-proxy']
upstream_if = 'eth1'
downstream_if = 'eth2'
-class TestProtocolsIGMPProxy(unittest.TestCase):
+class TestProtocolsIGMPProxy(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
- self.session.set(['interfaces', 'ethernet', upstream_if, 'address', '172.16.1.1/24'])
+ self.cli_set(['interfaces', 'ethernet', upstream_if, 'address', '172.16.1.1/24'])
def tearDown(self):
- self.session.delete(['interfaces', 'ethernet', upstream_if, 'address'])
- self.session.delete(base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(['interfaces', 'ethernet', upstream_if, 'address'])
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_igmpproxy(self):
threshold = '20'
altnet = '192.0.2.0/24'
whitelist = '10.0.0.0/8'
- self.session.set(base_path + ['disable-quickleave'])
- self.session.set(base_path + ['interface', upstream_if, 'threshold', threshold])
- self.session.set(base_path + ['interface', upstream_if, 'alt-subnet', altnet])
- self.session.set(base_path + ['interface', upstream_if, 'whitelist', whitelist])
+ self.cli_set(base_path + ['disable-quickleave'])
+ self.cli_set(base_path + ['interface', upstream_if, 'threshold', threshold])
+ self.cli_set(base_path + ['interface', upstream_if, 'alt-subnet', altnet])
+ self.cli_set(base_path + ['interface', upstream_if, 'whitelist', whitelist])
# Must define an upstream and at least 1 downstream interface!
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(base_path + ['interface', upstream_if, 'role', 'upstream'])
+ self.cli_commit()
+ self.cli_set(base_path + ['interface', upstream_if, 'role', 'upstream'])
# Interface does not exist
- self.session.set(base_path + ['interface', 'eth20', 'role', 'upstream'])
+ self.cli_set(base_path + ['interface', 'eth20', 'role', 'upstream'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(base_path + ['interface', 'eth20'])
+ self.cli_commit()
+ self.cli_delete(base_path + ['interface', 'eth20'])
# Only 1 upstream interface allowed
- self.session.set(base_path + ['interface', downstream_if, 'role', 'upstream'])
+ self.cli_set(base_path + ['interface', downstream_if, 'role', 'upstream'])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(base_path + ['interface', downstream_if, 'role', 'downstream'])
+ self.cli_commit()
+ self.cli_set(base_path + ['interface', downstream_if, 'role', 'downstream'])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Check generated configuration
config = read_file(IGMP_PROXY_CONF)
diff --git a/smoketest/scripts/cli/test_protocols_isis.py b/smoketest/scripts/cli/test_protocols_isis.py
new file mode 100755
index 000000000..623cb044d
--- /dev/null
+++ b/smoketest/scripts/cli/test_protocols_isis.py
@@ -0,0 +1,102 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2021 VyOS maintainers and contributors
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or later as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import unittest
+
+from base_vyostest_shim import VyOSUnitTestSHIM
+from vyos.configsession import ConfigSession
+from vyos.configsession import ConfigSessionError
+from vyos.ifconfig import Section
+from vyos.util import process_named_running
+
+PROCESS_NAME = 'isisd'
+base_path = ['protocols', 'isis']
+
+domain = 'VyOS'
+net = '49.0001.1921.6800.1002.00'
+
+class TestProtocolsISIS(VyOSUnitTestSHIM.TestCase):
+ def tearDown(self):
+ self.cli_delete(base_path)
+ self.cli_commit()
+
+ # Check for running process
+ self.assertTrue(process_named_running(PROCESS_NAME))
+
+ def test_isis_01_redistribute(self):
+ prefix_list = 'EXPORT-ISIS'
+ route_map = 'EXPORT-ISIS'
+ rule = '10'
+ self.cli_set(['policy', 'prefix-list', prefix_list, 'rule', rule, 'action', 'permit'])
+ self.cli_set(['policy', 'prefix-list', prefix_list, 'rule', rule, 'prefix', '203.0.113.0/24'])
+ self.cli_set(['policy', 'route-map', route_map, 'rule', rule, 'action', 'permit'])
+ self.cli_set(['policy', 'route-map', route_map, 'rule', rule, 'match', 'ip', 'address', 'prefix-list', prefix_list])
+
+ self.cli_set(base_path + ['net', net])
+ self.cli_set(base_path + ['redistribute', 'ipv4', 'connected', 'level-2', 'route-map', route_map])
+
+ interfaces = Section.interfaces('ethernet')
+ for interface in interfaces:
+ self.cli_set(base_path + ['interface', interface])
+
+ # Commit all changes
+ self.cli_commit()
+
+ # Verify all changes
+ tmp = self.getFRRconfig(f'router isis {domain}')
+ self.assertIn(f' net {net}', tmp)
+ self.assertIn(f' redistribute ipv4 connected level-2 route-map {route_map}', tmp)
+
+ for interface in interfaces:
+ tmp = self.getFRRconfig(f'interface {interface}')
+ self.assertIn(f' ip router isis {domain}', tmp)
+
+ self.cli_delete(['policy'])
+
+
+ def test_isis_02_vrfs(self):
+ vrfs = ['red', 'green', 'blue']
+ # It is safe to assume that when the basic VRF test works, all other
+ # IS-IS related features work, as we entirely inherit the CLI templates
+ # and Jinja2 FRR template.
+ table = '1000'
+ vrf = 'red'
+ vrf_base = ['vrf', 'name', vrf]
+ vrf_iface = 'eth1'
+ self.cli_set(vrf_base + ['table', table])
+ self.cli_set(vrf_base + ['protocols', 'isis', 'net', net])
+ self.cli_set(vrf_base + ['protocols', 'isis', 'interface', vrf_iface])
+ self.cli_set(['interfaces', 'ethernet', vrf_iface, 'vrf', vrf])
+
+ # Also set a default VRF IS-IS config
+ self.cli_set(base_path + ['net', net])
+ self.cli_set(base_path + ['interface', 'eth0'])
+ self.cli_commit()
+
+ # Verify FRR isisd configuration
+ tmp = self.getFRRconfig(f'router isis {domain}')
+ self.assertIn(f'router isis {domain}', tmp)
+ self.assertIn(f' net {net}', tmp)
+
+ tmp = self.getFRRconfig(f'router isis {domain} vrf {vrf}')
+ self.assertIn(f'router isis {domain} vrf {vrf}', tmp)
+ self.assertIn(f' net {net}', tmp)
+
+ self.cli_delete(['vrf', 'name', vrf])
+ self.cli_delete(['interfaces', 'ethernet', vrf_iface, 'vrf'])
+
+if __name__ == '__main__':
+ unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_protocols_ospf.py b/smoketest/scripts/cli/test_protocols_ospf.py
index d9a6c17e4..8d94c86cb 100755
--- a/smoketest/scripts/cli/test_protocols_ospf.py
+++ b/smoketest/scripts/cli/test_protocols_ospf.py
@@ -14,12 +14,11 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import unittest
-from vyos.configsession import ConfigSession
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.ifconfig import Section
-from vyos.util import cmd
from vyos.util import process_named_running
PROCESS_NAME = 'ospfd'
@@ -27,56 +26,46 @@ base_path = ['protocols', 'ospf']
route_map = 'foo-bar-baz10'
-def getFRROSPFconfig():
- return cmd('vtysh -c "show run" | sed -n "/^router ospf/,/^!/p"')
-
-def getFRRInterfaceConfig(interface):
- return cmd(f'vtysh -c "show run" | sed -n "/^interface {interface}$/,/^!/p"')
-
-class TestProtocolsOSPF(unittest.TestCase):
+class TestProtocolsOSPF(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
- self.session.set(['policy', 'route-map', route_map, 'rule', '10', 'action', 'permit'])
- self.session.set(['policy', 'route-map', route_map, 'rule', '20', 'action', 'permit'])
+ self.cli_set(['policy', 'route-map', route_map, 'rule', '10', 'action', 'permit'])
+ self.cli_set(['policy', 'route-map', route_map, 'rule', '20', 'action', 'permit'])
def tearDown(self):
# Check for running process
self.assertTrue(process_named_running(PROCESS_NAME))
-
- self.session.delete(['policy', 'route-map', route_map])
- self.session.delete(base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(['policy', 'route-map', route_map])
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_ospf_01_defaults(self):
# commit changes
- self.session.set(base_path)
- self.session.commit()
+ self.cli_set(base_path)
+ self.cli_commit()
# Verify FRR ospfd configuration
- frrconfig = getFRROSPFconfig()
+ frrconfig = self.getFRRconfig('router ospf')
self.assertIn(f'router ospf', frrconfig)
self.assertIn(f' auto-cost reference-bandwidth 100', frrconfig)
self.assertIn(f' timers throttle spf 200 1000 10000', frrconfig) # defaults
-
def test_ospf_02_simple(self):
router_id = '127.0.0.1'
abr_type = 'ibm'
bandwidth = '1000'
metric = '123'
- self.session.set(base_path + ['auto-cost', 'reference-bandwidth', bandwidth])
- self.session.set(base_path + ['parameters', 'router-id', router_id])
- self.session.set(base_path + ['parameters', 'abr-type', abr_type])
- self.session.set(base_path + ['log-adjacency-changes', 'detail'])
- self.session.set(base_path + ['default-metric', metric])
+ self.cli_set(base_path + ['auto-cost', 'reference-bandwidth', bandwidth])
+ self.cli_set(base_path + ['parameters', 'router-id', router_id])
+ self.cli_set(base_path + ['parameters', 'abr-type', abr_type])
+ self.cli_set(base_path + ['log-adjacency-changes', 'detail'])
+ self.cli_set(base_path + ['default-metric', metric])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR ospfd configuration
- frrconfig = getFRROSPFconfig()
+ frrconfig = self.getFRRconfig('router ospf')
self.assertIn(f'router ospf', frrconfig)
self.assertIn(f' auto-cost reference-bandwidth {bandwidth}', frrconfig)
self.assertIn(f' ospf router-id {router_id}', frrconfig)
@@ -90,22 +79,22 @@ class TestProtocolsOSPF(unittest.TestCase):
seq = '10'
protocols = ['bgp', 'connected', 'isis', 'kernel', 'rip', 'static']
- self.session.set(['policy', 'access-list', acl, 'rule', seq, 'action', 'permit'])
- self.session.set(['policy', 'access-list', acl, 'rule', seq, 'source', 'any'])
- self.session.set(['policy', 'access-list', acl, 'rule', seq, 'destination', 'any'])
+ self.cli_set(['policy', 'access-list', acl, 'rule', seq, 'action', 'permit'])
+ self.cli_set(['policy', 'access-list', acl, 'rule', seq, 'source', 'any'])
+ self.cli_set(['policy', 'access-list', acl, 'rule', seq, 'destination', 'any'])
for ptotocol in protocols:
- self.session.set(base_path + ['access-list', acl, 'export', ptotocol])
+ self.cli_set(base_path + ['access-list', acl, 'export', ptotocol])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR ospfd configuration
- frrconfig = getFRROSPFconfig()
+ frrconfig = self.getFRRconfig('router ospf')
self.assertIn(f'router ospf', frrconfig)
self.assertIn(f' timers throttle spf 200 1000 10000', frrconfig) # defaults
for ptotocol in protocols:
self.assertIn(f' distribute-list {acl} out {ptotocol}', frrconfig) # defaults
- self.session.delete(['policy', 'access-list', acl])
+ self.cli_delete(['policy', 'access-list', acl])
def test_ospf_04_default_originate(self):
@@ -113,25 +102,25 @@ class TestProtocolsOSPF(unittest.TestCase):
metric = '50'
metric_type = '1'
- self.session.set(base_path + ['default-information', 'originate', 'metric', metric])
- self.session.set(base_path + ['default-information', 'originate', 'metric-type', metric_type])
- self.session.set(base_path + ['default-information', 'originate', 'route-map', route_map])
+ self.cli_set(base_path + ['default-information', 'originate', 'metric', metric])
+ self.cli_set(base_path + ['default-information', 'originate', 'metric-type', metric_type])
+ self.cli_set(base_path + ['default-information', 'originate', 'route-map', route_map])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR ospfd configuration
- frrconfig = getFRROSPFconfig()
+ frrconfig = self.getFRRconfig('router ospf')
self.assertIn(f'router ospf', frrconfig)
self.assertIn(f' timers throttle spf 200 1000 10000', frrconfig) # defaults
self.assertIn(f' default-information originate metric {metric} metric-type {metric_type} route-map {route_map}', frrconfig)
# Now set 'always'
- self.session.set(base_path + ['default-information', 'originate', 'always'])
- self.session.commit()
+ self.cli_set(base_path + ['default-information', 'originate', 'always'])
+ self.cli_commit()
# Verify FRR ospfd configuration
- frrconfig = getFRROSPFconfig()
+ frrconfig = self.getFRRconfig('router ospf')
self.assertIn(f' default-information originate always metric {metric} metric-type {metric_type} route-map {route_map}', frrconfig)
@@ -144,21 +133,21 @@ class TestProtocolsOSPF(unittest.TestCase):
on_shutdown = '60'
refresh = '50'
- self.session.set(base_path + ['distance', 'global', global_distance])
- self.session.set(base_path + ['distance', 'ospf', 'external', external])
- self.session.set(base_path + ['distance', 'ospf', 'intra-area', intra_area])
+ self.cli_set(base_path + ['distance', 'global', global_distance])
+ self.cli_set(base_path + ['distance', 'ospf', 'external', external])
+ self.cli_set(base_path + ['distance', 'ospf', 'intra-area', intra_area])
- self.session.set(base_path + ['max-metric', 'router-lsa', 'on-startup', on_startup])
- self.session.set(base_path + ['max-metric', 'router-lsa', 'on-shutdown', on_shutdown])
+ self.cli_set(base_path + ['max-metric', 'router-lsa', 'on-startup', on_startup])
+ self.cli_set(base_path + ['max-metric', 'router-lsa', 'on-shutdown', on_shutdown])
- self.session.set(base_path + ['mpls-te', 'enable'])
- self.session.set(base_path + ['refresh', 'timers', refresh])
+ self.cli_set(base_path + ['mpls-te', 'enable'])
+ self.cli_set(base_path + ['refresh', 'timers', refresh])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR ospfd configuration
- frrconfig = getFRROSPFconfig()
+ frrconfig = self.getFRRconfig('router ospf')
self.assertIn(f'router ospf', frrconfig)
self.assertIn(f' mpls-te on', frrconfig)
self.assertIn(f' mpls-te router-address 0.0.0.0', frrconfig) # default
@@ -170,10 +159,10 @@ class TestProtocolsOSPF(unittest.TestCase):
# enable inter-area
- self.session.set(base_path + ['distance', 'ospf', 'inter-area', inter_area])
- self.session.commit()
+ self.cli_set(base_path + ['distance', 'ospf', 'inter-area', inter_area])
+ self.cli_commit()
- frrconfig = getFRROSPFconfig()
+ frrconfig = self.getFRRconfig('router ospf')
self.assertIn(f' distance ospf intra-area {intra_area} inter-area {inter_area} external {external}', frrconfig)
@@ -182,30 +171,30 @@ class TestProtocolsOSPF(unittest.TestCase):
poll_interval = '20'
neighbors = ['1.1.1.1', '2.2.2.2', '3.3.3.3']
for neighbor in neighbors:
- self.session.set(base_path + ['neighbor', neighbor, 'priority', priority])
- self.session.set(base_path + ['neighbor', neighbor, 'poll-interval', poll_interval])
+ self.cli_set(base_path + ['neighbor', neighbor, 'priority', priority])
+ self.cli_set(base_path + ['neighbor', neighbor, 'poll-interval', poll_interval])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR ospfd configuration
- frrconfig = getFRROSPFconfig()
+ frrconfig = self.getFRRconfig('router ospf')
self.assertIn(f'router ospf', frrconfig)
for neighbor in neighbors:
self.assertIn(f' neighbor {neighbor} priority {priority} poll-interval {poll_interval}', frrconfig) # default
def test_ospf_07_passive_interface(self):
- self.session.set(base_path + ['passive-interface', 'default'])
+ self.cli_set(base_path + ['passive-interface', 'default'])
interfaces = Section.interfaces('ethernet')
for interface in interfaces:
- self.session.set(base_path + ['passive-interface-exclude', interface])
+ self.cli_set(base_path + ['passive-interface-exclude', interface])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR ospfd configuration
- frrconfig = getFRROSPFconfig()
+ frrconfig = self.getFRRconfig('router ospf')
self.assertIn(f'router ospf', frrconfig)
self.assertIn(f' passive-interface default', frrconfig) # default
for interface in interfaces:
@@ -218,16 +207,16 @@ class TestProtocolsOSPF(unittest.TestCase):
redistribute = ['bgp', 'connected', 'isis', 'kernel', 'rip', 'static']
for protocol in redistribute:
- self.session.set(base_path + ['redistribute', protocol, 'metric', metric])
- self.session.set(base_path + ['redistribute', protocol, 'route-map', route_map])
+ self.cli_set(base_path + ['redistribute', protocol, 'metric', metric])
+ self.cli_set(base_path + ['redistribute', protocol, 'route-map', route_map])
if protocol not in ['kernel', 'static']:
- self.session.set(base_path + ['redistribute', protocol, 'metric-type', metric_type])
+ self.cli_set(base_path + ['redistribute', protocol, 'metric-type', metric_type])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR ospfd configuration
- frrconfig = getFRROSPFconfig()
+ frrconfig = self.getFRRconfig('router ospf')
self.assertIn(f'router ospf', frrconfig)
for protocol in redistribute:
if protocol in ['kernel', 'static']:
@@ -235,6 +224,7 @@ class TestProtocolsOSPF(unittest.TestCase):
else:
self.assertIn(f' redistribute {protocol} metric {metric} metric-type {metric_type} route-map {route_map}', frrconfig)
+
def test_ospf_09_virtual_link(self):
networks = ['10.0.0.0/8', '172.16.0.0/12', '192.168.0.0/16']
area = '10'
@@ -245,38 +235,26 @@ class TestProtocolsOSPF(unittest.TestCase):
transmit = '5'
dead = '40'
- self.session.set(base_path + ['area', area, 'shortcut', shortcut])
- self.session.set(base_path + ['area', area, 'virtual-link', virtual_link, 'hello-interval', hello])
- self.session.set(base_path + ['area', area, 'virtual-link', virtual_link, 'retransmit-interval', retransmit])
- self.session.set(base_path + ['area', area, 'virtual-link', virtual_link, 'transmit-delay', transmit])
- self.session.set(base_path + ['area', area, 'virtual-link', virtual_link, 'dead-interval', dead])
+ self.cli_set(base_path + ['area', area, 'shortcut', shortcut])
+ self.cli_set(base_path + ['area', area, 'virtual-link', virtual_link, 'hello-interval', hello])
+ self.cli_set(base_path + ['area', area, 'virtual-link', virtual_link, 'retransmit-interval', retransmit])
+ self.cli_set(base_path + ['area', area, 'virtual-link', virtual_link, 'transmit-delay', transmit])
+ self.cli_set(base_path + ['area', area, 'virtual-link', virtual_link, 'dead-interval', dead])
for network in networks:
- self.session.set(base_path + ['area', area, 'network', network])
+ self.cli_set(base_path + ['area', area, 'network', network])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR ospfd configuration
- frrconfig = getFRROSPFconfig()
- import pprint
- # From time to time the CI fails with an error like:
- # ======================================================================
- # FAIL: test_ospf_09_virtual_link (__main__.TestProtocolsOSPF)
- # ----------------------------------------------------------------------
- # Traceback (most recent call last):
- # File "/usr/libexec/vyos/tests/smoke/cli/test_protocols_ospf.py", line 261, in test_ospf_09_virtual_link
- # self.assertIn(f'router ospf', frrconfig)
- # AssertionError: 'router ospf' not found in ''
- #
- # Add some debug code so we can find the root cause
- pprint.pprint(frrconfig)
-
+ frrconfig = self.getFRRconfig('router ospf')
self.assertIn(f'router ospf', frrconfig)
self.assertIn(f' area {area} shortcut {shortcut}', frrconfig)
self.assertIn(f' area {area} virtual-link {virtual_link} hello-interval {hello} retransmit-interval {retransmit} transmit-delay {transmit} dead-interval {dead}', frrconfig)
for network in networks:
self.assertIn(f' network {network} area {area}', frrconfig)
+
def test_ospf_10_interface_configureation(self):
interfaces = Section.interfaces('ethernet')
password = 'vyos1234'
@@ -286,19 +264,19 @@ class TestProtocolsOSPF(unittest.TestCase):
priority = '200'
for interface in interfaces:
- self.session.set(base_path + ['interface', interface, 'authentication', 'plaintext-password', password])
- self.session.set(base_path + ['interface', interface, 'bandwidth', bandwidth])
- self.session.set(base_path + ['interface', interface, 'bfd'])
- self.session.set(base_path + ['interface', interface, 'cost', cost])
- self.session.set(base_path + ['interface', interface, 'mtu-ignore'])
- self.session.set(base_path + ['interface', interface, 'network', network])
- self.session.set(base_path + ['interface', interface, 'priority', priority])
+ self.cli_set(base_path + ['interface', interface, 'authentication', 'plaintext-password', password])
+ self.cli_set(base_path + ['interface', interface, 'bandwidth', bandwidth])
+ self.cli_set(base_path + ['interface', interface, 'bfd'])
+ self.cli_set(base_path + ['interface', interface, 'cost', cost])
+ self.cli_set(base_path + ['interface', interface, 'mtu-ignore'])
+ self.cli_set(base_path + ['interface', interface, 'network', network])
+ self.cli_set(base_path + ['interface', interface, 'priority', priority])
# commit changes
- self.session.commit()
+ self.cli_commit()
for interface in interfaces:
- config = getFRRInterfaceConfig(interface)
+ config = self.getFRRconfig(f'interface {interface}')
self.assertIn(f'interface {interface}', config)
self.assertIn(f' ip ospf authentication-key {password}', config)
self.assertIn(f' ip ospf bfd', config)
@@ -308,5 +286,36 @@ class TestProtocolsOSPF(unittest.TestCase):
self.assertIn(f' ip ospf priority {priority}', config)
self.assertIn(f' bandwidth {bandwidth}', config)
+
+ def test_ospf_11_vrfs(self):
+ # It is safe to assume that when the basic VRF test works, all
+ # other OSPF related features work, as we entirely inherit the CLI
+ # templates and Jinja2 FRR template.
+ table = '1000'
+ vrf = 'blue'
+ vrf_base = ['vrf', 'name', vrf]
+ vrf_iface = 'eth1'
+ self.cli_set(vrf_base + ['table', table])
+ self.cli_set(vrf_base + ['protocols', 'ospf', 'interface', vrf_iface])
+ self.cli_set(['interfaces', 'ethernet', vrf_iface, 'vrf', vrf])
+
+ # Also set a default VRF OSPF config
+ self.cli_set(base_path)
+ self.cli_commit()
+
+ # Verify FRR ospfd configuration
+ frrconfig = self.getFRRconfig('router ospf')
+ self.assertIn(f'router ospf', frrconfig)
+ self.assertIn(f' auto-cost reference-bandwidth 100', frrconfig)
+ self.assertIn(f' timers throttle spf 200 1000 10000', frrconfig) # defaults
+
+ frrconfig = self.getFRRconfig(f'router ospf vrf {vrf}')
+ self.assertIn(f'router ospf vrf {vrf}', frrconfig)
+ self.assertIn(f' auto-cost reference-bandwidth 100', frrconfig)
+ self.assertIn(f' timers throttle spf 200 1000 10000', frrconfig) # defaults
+
+ self.cli_delete(['vrf', 'name', vrf])
+ self.cli_delete(['interfaces', 'ethernet', vrf_iface, 'vrf'])
+
if __name__ == '__main__':
unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_protocols_ospfv3.py b/smoketest/scripts/cli/test_protocols_ospfv3.py
index 754c4488f..6bb551642 100755
--- a/smoketest/scripts/cli/test_protocols_ospfv3.py
+++ b/smoketest/scripts/cli/test_protocols_ospfv3.py
@@ -14,12 +14,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.ifconfig import Section
-from vyos.util import cmd
from vyos.util import process_named_running
PROCESS_NAME = 'ospf6d'
@@ -28,47 +28,35 @@ base_path = ['protocols', 'ospfv3']
router_id = '192.0.2.1'
default_area = '0'
-def getFRROSPFconfig():
- return cmd('vtysh -c "show run" | sed -n "/router ospf6/,/^!/p"')
-
-def getFRRIFconfig(iface):
- return cmd(f'vtysh -c "show run" | sed -n "/^interface {iface}/,/^!/p"')
-
-class TestProtocolsOSPFv3(unittest.TestCase):
- def setUp(self):
- self.session = ConfigSession(os.getpid())
-
+class TestProtocolsOSPFv3(VyOSUnitTestSHIM.TestCase):
def tearDown(self):
# Check for running process
self.assertTrue(process_named_running(PROCESS_NAME))
-
- self.session.delete(base_path)
- self.session.commit()
- del self.session
-
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_ospfv3_01_basic(self):
seq = '10'
prefix = '2001:db8::/32'
acl_name = 'foo-acl-100'
- self.session.set(['policy', 'access-list6', acl_name, 'rule', seq, 'action', 'permit'])
- self.session.set(['policy', 'access-list6', acl_name, 'rule', seq, 'source', 'any'])
+ self.cli_set(['policy', 'access-list6', acl_name, 'rule', seq, 'action', 'permit'])
+ self.cli_set(['policy', 'access-list6', acl_name, 'rule', seq, 'source', 'any'])
- self.session.set(base_path + ['parameters', 'router-id', router_id])
- self.session.set(base_path + ['area', default_area, 'range', prefix, 'advertise'])
- self.session.set(base_path + ['area', default_area, 'export-list', acl_name])
- self.session.set(base_path + ['area', default_area, 'import-list', acl_name])
+ self.cli_set(base_path + ['parameters', 'router-id', router_id])
+ self.cli_set(base_path + ['area', default_area, 'range', prefix, 'advertise'])
+ self.cli_set(base_path + ['area', default_area, 'export-list', acl_name])
+ self.cli_set(base_path + ['area', default_area, 'import-list', acl_name])
interfaces = Section.interfaces('ethernet')
for interface in interfaces:
- self.session.set(base_path + ['area', default_area, 'interface', interface])
+ self.cli_set(base_path + ['area', default_area, 'interface', interface])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR ospfd configuration
- frrconfig = getFRROSPFconfig()
+ frrconfig = self.getFRRconfig('router ospf6')
self.assertIn(f'router ospf6', frrconfig)
self.assertIn(f' area {default_area} range {prefix}', frrconfig)
self.assertIn(f' ospf6 router-id {router_id}', frrconfig)
@@ -78,7 +66,7 @@ class TestProtocolsOSPFv3(unittest.TestCase):
for interface in interfaces:
self.assertIn(f' interface {interface} area {default_area}', frrconfig)
- self.session.delete(['policy', 'access-list6', acl_name])
+ self.cli_delete(['policy', 'access-list6', acl_name])
def test_ospfv3_02_distance(self):
@@ -87,16 +75,16 @@ class TestProtocolsOSPFv3(unittest.TestCase):
dist_inter_area = '120'
dist_intra_area = '130'
- self.session.set(base_path + ['distance', 'global', dist_global])
- self.session.set(base_path + ['distance', 'ospfv3', 'external', dist_external])
- self.session.set(base_path + ['distance', 'ospfv3', 'inter-area', dist_inter_area])
- self.session.set(base_path + ['distance', 'ospfv3', 'intra-area', dist_intra_area])
+ self.cli_set(base_path + ['distance', 'global', dist_global])
+ self.cli_set(base_path + ['distance', 'ospfv3', 'external', dist_external])
+ self.cli_set(base_path + ['distance', 'ospfv3', 'inter-area', dist_inter_area])
+ self.cli_set(base_path + ['distance', 'ospfv3', 'intra-area', dist_intra_area])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR ospfd configuration
- frrconfig = getFRROSPFconfig()
+ frrconfig = self.getFRRconfig('router ospf6')
self.assertIn(f'router ospf6', frrconfig)
self.assertIn(f' distance {dist_global}', frrconfig)
self.assertIn(f' distance ospf6 intra-area {dist_intra_area} inter-area {dist_inter_area} external {dist_external}', frrconfig)
@@ -107,51 +95,51 @@ class TestProtocolsOSPFv3(unittest.TestCase):
route_map_seq = '10'
redistribute = ['bgp', 'connected', 'kernel', 'ripng', 'static']
- self.session.set(['policy', 'route-map', route_map, 'rule', route_map_seq, 'action', 'permit'])
+ self.cli_set(['policy', 'route-map', route_map, 'rule', route_map_seq, 'action', 'permit'])
for protocol in redistribute:
- self.session.set(base_path + ['redistribute', protocol, 'route-map', route_map])
+ self.cli_set(base_path + ['redistribute', protocol, 'route-map', route_map])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR ospfd configuration
- frrconfig = getFRROSPFconfig()
+ frrconfig = self.getFRRconfig('router ospf6')
self.assertIn(f'router ospf6', frrconfig)
for protocol in redistribute:
self.assertIn(f' redistribute {protocol} route-map {route_map}', frrconfig)
- def test_ospfv3_0104_interfaces(self):
+ def test_ospfv3_04_interfaces(self):
- self.session.set(base_path + ['parameters', 'router-id', router_id])
- self.session.set(base_path + ['area', default_area])
+ self.cli_set(base_path + ['parameters', 'router-id', router_id])
+ self.cli_set(base_path + ['area', default_area])
cost = '100'
priority = '10'
interfaces = Section.interfaces('ethernet')
for interface in interfaces:
if_base = base_path + ['interface', interface]
- self.session.set(if_base + ['bfd'])
- self.session.set(if_base + ['cost', cost])
- self.session.set(if_base + ['instance-id', '0'])
- self.session.set(if_base + ['mtu-ignore'])
- self.session.set(if_base + ['network', 'point-to-point'])
- self.session.set(if_base + ['passive'])
- self.session.set(if_base + ['priority', priority])
+ self.cli_set(if_base + ['bfd'])
+ self.cli_set(if_base + ['cost', cost])
+ self.cli_set(if_base + ['instance-id', '0'])
+ self.cli_set(if_base + ['mtu-ignore'])
+ self.cli_set(if_base + ['network', 'point-to-point'])
+ self.cli_set(if_base + ['passive'])
+ self.cli_set(if_base + ['priority', priority])
cost = str(int(cost) + 10)
priority = str(int(priority) + 5)
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR ospfd configuration
- frrconfig = getFRROSPFconfig()
+ frrconfig = self.getFRRconfig('router ospf6')
self.assertIn(f'router ospf6', frrconfig)
cost = '100'
priority = '10'
for interface in interfaces:
- if_config = getFRRIFconfig(interface)
+ if_config = self.getFRRconfig(f'interface {interface}')
self.assertIn(f'interface {interface}', if_config)
self.assertIn(f' ipv6 ospf6 bfd', if_config)
self.assertIn(f' ipv6 ospf6 cost {cost}', if_config)
diff --git a/smoketest/scripts/cli/test_protocols_rip.py b/smoketest/scripts/cli/test_protocols_rip.py
index f42ea0c0a..3406688c5 100755
--- a/smoketest/scripts/cli/test_protocols_rip.py
+++ b/smoketest/scripts/cli/test_protocols_rip.py
@@ -14,12 +14,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.ifconfig import Section
-from vyos.util import cmd
from vyos.util import process_named_running
PROCESS_NAME = 'ripd'
@@ -31,35 +31,28 @@ route_map = 'FooBar123'
base_path = ['protocols', 'rip']
-def getFRRconfig():
- return cmd('vtysh -c "show run" | sed -n "/router rip/,/^!/p"')
-
-class TestProtocolsRIP(unittest.TestCase):
+class TestProtocolsRIP(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
-
- self.session.set(['policy', 'access-list', acl_in, 'rule', '10', 'action', 'permit'])
- self.session.set(['policy', 'access-list', acl_in, 'rule', '10', 'source', 'any'])
- self.session.set(['policy', 'access-list', acl_in, 'rule', '10', 'destination', 'any'])
- self.session.set(['policy', 'access-list', acl_out, 'rule', '20', 'action', 'deny'])
- self.session.set(['policy', 'access-list', acl_out, 'rule', '20', 'source', 'any'])
- self.session.set(['policy', 'access-list', acl_out, 'rule', '20', 'destination', 'any'])
- self.session.set(['policy', 'prefix-list', prefix_list_in, 'rule', '100', 'action', 'permit'])
- self.session.set(['policy', 'prefix-list', prefix_list_in, 'rule', '100', 'prefix', '192.0.2.0/24'])
- self.session.set(['policy', 'prefix-list', prefix_list_out, 'rule', '200', 'action', 'deny'])
- self.session.set(['policy', 'prefix-list', prefix_list_out, 'rule', '200', 'prefix', '192.0.2.0/24'])
- self.session.set(['policy', 'route-map', route_map, 'rule', '10', 'action', 'permit'])
+ self.cli_set(['policy', 'access-list', acl_in, 'rule', '10', 'action', 'permit'])
+ self.cli_set(['policy', 'access-list', acl_in, 'rule', '10', 'source', 'any'])
+ self.cli_set(['policy', 'access-list', acl_in, 'rule', '10', 'destination', 'any'])
+ self.cli_set(['policy', 'access-list', acl_out, 'rule', '20', 'action', 'deny'])
+ self.cli_set(['policy', 'access-list', acl_out, 'rule', '20', 'source', 'any'])
+ self.cli_set(['policy', 'access-list', acl_out, 'rule', '20', 'destination', 'any'])
+ self.cli_set(['policy', 'prefix-list', prefix_list_in, 'rule', '100', 'action', 'permit'])
+ self.cli_set(['policy', 'prefix-list', prefix_list_in, 'rule', '100', 'prefix', '192.0.2.0/24'])
+ self.cli_set(['policy', 'prefix-list', prefix_list_out, 'rule', '200', 'action', 'deny'])
+ self.cli_set(['policy', 'prefix-list', prefix_list_out, 'rule', '200', 'prefix', '192.0.2.0/24'])
+ self.cli_set(['policy', 'route-map', route_map, 'rule', '10', 'action', 'permit'])
def tearDown(self):
- self.session.delete(base_path)
- self.session.delete(['policy', 'access-list', acl_in])
- self.session.delete(['policy', 'access-list', acl_out])
- self.session.delete(['policy', 'prefix-list', prefix_list_in])
- self.session.delete(['policy', 'prefix-list', prefix_list_out])
- self.session.delete(['policy', 'route-map', route_map])
-
- self.session.commit()
- del self.session
+ self.cli_delete(base_path)
+ self.cli_delete(['policy', 'access-list', acl_in])
+ self.cli_delete(['policy', 'access-list', acl_out])
+ self.cli_delete(['policy', 'prefix-list', prefix_list_in])
+ self.cli_delete(['policy', 'prefix-list', prefix_list_out])
+ self.cli_delete(['policy', 'route-map', route_map])
+ self.cli_commit()
# Check for running process
self.assertTrue(process_named_running(PROCESS_NAME))
@@ -76,39 +69,39 @@ class TestProtocolsRIP(unittest.TestCase):
timer_timeout = '1000'
timer_update = '90'
- self.session.set(base_path + ['default-distance', distance])
- self.session.set(base_path + ['default-information', 'originate'])
- self.session.set(base_path + ['default-metric', metric])
- self.session.set(base_path + ['distribute-list', 'access-list', 'in', acl_in])
- self.session.set(base_path + ['distribute-list', 'access-list', 'out', acl_out])
- self.session.set(base_path + ['distribute-list', 'prefix-list', 'in', prefix_list_in])
- self.session.set(base_path + ['distribute-list', 'prefix-list', 'out', prefix_list_out])
- self.session.set(base_path + ['passive-interface', 'default'])
- self.session.set(base_path + ['timers', 'garbage-collection', timer_garbage])
- self.session.set(base_path + ['timers', 'timeout', timer_timeout])
- self.session.set(base_path + ['timers', 'update', timer_update])
+ self.cli_set(base_path + ['default-distance', distance])
+ self.cli_set(base_path + ['default-information', 'originate'])
+ self.cli_set(base_path + ['default-metric', metric])
+ self.cli_set(base_path + ['distribute-list', 'access-list', 'in', acl_in])
+ self.cli_set(base_path + ['distribute-list', 'access-list', 'out', acl_out])
+ self.cli_set(base_path + ['distribute-list', 'prefix-list', 'in', prefix_list_in])
+ self.cli_set(base_path + ['distribute-list', 'prefix-list', 'out', prefix_list_out])
+ self.cli_set(base_path + ['passive-interface', 'default'])
+ self.cli_set(base_path + ['timers', 'garbage-collection', timer_garbage])
+ self.cli_set(base_path + ['timers', 'timeout', timer_timeout])
+ self.cli_set(base_path + ['timers', 'update', timer_update])
for interface in interfaces:
- self.session.set(base_path + ['interface', interface])
- self.session.set(base_path + ['distribute-list', 'interface', interface, 'access-list', 'in', acl_in])
- self.session.set(base_path + ['distribute-list', 'interface', interface, 'access-list', 'out', acl_out])
- self.session.set(base_path + ['distribute-list', 'interface', interface, 'prefix-list', 'in', prefix_list_in])
- self.session.set(base_path + ['distribute-list', 'interface', interface, 'prefix-list', 'out', prefix_list_out])
+ self.cli_set(base_path + ['interface', interface])
+ self.cli_set(base_path + ['distribute-list', 'interface', interface, 'access-list', 'in', acl_in])
+ self.cli_set(base_path + ['distribute-list', 'interface', interface, 'access-list', 'out', acl_out])
+ self.cli_set(base_path + ['distribute-list', 'interface', interface, 'prefix-list', 'in', prefix_list_in])
+ self.cli_set(base_path + ['distribute-list', 'interface', interface, 'prefix-list', 'out', prefix_list_out])
for neighbor in neighbors:
- self.session.set(base_path + ['neighbor', neighbor])
+ self.cli_set(base_path + ['neighbor', neighbor])
for network in networks:
- self.session.set(base_path + ['network', network])
- self.session.set(base_path + ['network-distance', network, 'distance', network_distance])
- self.session.set(base_path + ['route', network])
+ self.cli_set(base_path + ['network', network])
+ self.cli_set(base_path + ['network-distance', network, 'distance', network_distance])
+ self.cli_set(base_path + ['route', network])
for proto in redistribute:
- self.session.set(base_path + ['redistribute', proto, 'metric', metric])
- self.session.set(base_path + ['redistribute', proto, 'route-map', route_map])
+ self.cli_set(base_path + ['redistribute', proto, 'metric', metric])
+ self.cli_set(base_path + ['redistribute', proto, 'route-map', route_map])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR ospfd configuration
- frrconfig = getFRRconfig()
+ frrconfig = self.getFRRconfig('router rip')
self.assertIn(f'router rip', frrconfig)
self.assertIn(f' distance {distance}', frrconfig)
self.assertIn(f' default-information originate', frrconfig)
diff --git a/smoketest/scripts/cli/test_protocols_ripng.py b/smoketest/scripts/cli/test_protocols_ripng.py
index 6850b60d3..add92b73d 100755
--- a/smoketest/scripts/cli/test_protocols_ripng.py
+++ b/smoketest/scripts/cli/test_protocols_ripng.py
@@ -14,12 +14,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.ifconfig import Section
-from vyos.util import cmd
from vyos.util import process_named_running
PROCESS_NAME = 'ripngd'
@@ -31,33 +31,26 @@ route_map = 'FooBar123'
base_path = ['protocols', 'ripng']
-def getFRRconfig():
- return cmd('vtysh -c "show run" | sed -n "/router ripng/,/^!/p"')
-
-class TestProtocolsRIPng(unittest.TestCase):
+class TestProtocolsRIPng(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
-
- self.session.set(['policy', 'access-list6', acl_in, 'rule', '10', 'action', 'permit'])
- self.session.set(['policy', 'access-list6', acl_in, 'rule', '10', 'source', 'any'])
- self.session.set(['policy', 'access-list6', acl_out, 'rule', '20', 'action', 'deny'])
- self.session.set(['policy', 'access-list6', acl_out, 'rule', '20', 'source', 'any'])
- self.session.set(['policy', 'prefix-list6', prefix_list_in, 'rule', '100', 'action', 'permit'])
- self.session.set(['policy', 'prefix-list6', prefix_list_in, 'rule', '100', 'prefix', '2001:db8::/32'])
- self.session.set(['policy', 'prefix-list6', prefix_list_out, 'rule', '200', 'action', 'deny'])
- self.session.set(['policy', 'prefix-list6', prefix_list_out, 'rule', '200', 'prefix', '2001:db8::/32'])
- self.session.set(['policy', 'route-map', route_map, 'rule', '10', 'action', 'permit'])
+ self.cli_set(['policy', 'access-list6', acl_in, 'rule', '10', 'action', 'permit'])
+ self.cli_set(['policy', 'access-list6', acl_in, 'rule', '10', 'source', 'any'])
+ self.cli_set(['policy', 'access-list6', acl_out, 'rule', '20', 'action', 'deny'])
+ self.cli_set(['policy', 'access-list6', acl_out, 'rule', '20', 'source', 'any'])
+ self.cli_set(['policy', 'prefix-list6', prefix_list_in, 'rule', '100', 'action', 'permit'])
+ self.cli_set(['policy', 'prefix-list6', prefix_list_in, 'rule', '100', 'prefix', '2001:db8::/32'])
+ self.cli_set(['policy', 'prefix-list6', prefix_list_out, 'rule', '200', 'action', 'deny'])
+ self.cli_set(['policy', 'prefix-list6', prefix_list_out, 'rule', '200', 'prefix', '2001:db8::/32'])
+ self.cli_set(['policy', 'route-map', route_map, 'rule', '10', 'action', 'permit'])
def tearDown(self):
- self.session.delete(base_path)
- self.session.delete(['policy', 'access-list6', acl_in])
- self.session.delete(['policy', 'access-list6', acl_out])
- self.session.delete(['policy', 'prefix-list6', prefix_list_in])
- self.session.delete(['policy', 'prefix-list6', prefix_list_out])
- self.session.delete(['policy', 'route-map', route_map])
-
- self.session.commit()
- del self.session
+ self.cli_delete(base_path)
+ self.cli_delete(['policy', 'access-list6', acl_in])
+ self.cli_delete(['policy', 'access-list6', acl_out])
+ self.cli_delete(['policy', 'prefix-list6', prefix_list_in])
+ self.cli_delete(['policy', 'prefix-list6', prefix_list_out])
+ self.cli_delete(['policy', 'route-map', route_map])
+ self.cli_commit()
# Check for running process
self.assertTrue(process_named_running(PROCESS_NAME))
@@ -72,38 +65,38 @@ class TestProtocolsRIPng(unittest.TestCase):
timer_timeout = '1000'
timer_update = '90'
- self.session.set(base_path + ['default-information', 'originate'])
- self.session.set(base_path + ['default-metric', metric])
- self.session.set(base_path + ['distribute-list', 'access-list', 'in', acl_in])
- self.session.set(base_path + ['distribute-list', 'access-list', 'out', acl_out])
- self.session.set(base_path + ['distribute-list', 'prefix-list', 'in', prefix_list_in])
- self.session.set(base_path + ['distribute-list', 'prefix-list', 'out', prefix_list_out])
- self.session.set(base_path + ['passive-interface', 'default'])
- self.session.set(base_path + ['timers', 'garbage-collection', timer_garbage])
- self.session.set(base_path + ['timers', 'timeout', timer_timeout])
- self.session.set(base_path + ['timers', 'update', timer_update])
+ self.cli_set(base_path + ['default-information', 'originate'])
+ self.cli_set(base_path + ['default-metric', metric])
+ self.cli_set(base_path + ['distribute-list', 'access-list', 'in', acl_in])
+ self.cli_set(base_path + ['distribute-list', 'access-list', 'out', acl_out])
+ self.cli_set(base_path + ['distribute-list', 'prefix-list', 'in', prefix_list_in])
+ self.cli_set(base_path + ['distribute-list', 'prefix-list', 'out', prefix_list_out])
+ self.cli_set(base_path + ['passive-interface', 'default'])
+ self.cli_set(base_path + ['timers', 'garbage-collection', timer_garbage])
+ self.cli_set(base_path + ['timers', 'timeout', timer_timeout])
+ self.cli_set(base_path + ['timers', 'update', timer_update])
for aggregate in aggregates:
- self.session.set(base_path + ['aggregate-address', aggregate])
+ self.cli_set(base_path + ['aggregate-address', aggregate])
for interface in interfaces:
- self.session.set(base_path + ['interface', interface])
- self.session.set(base_path + ['distribute-list', 'interface', interface, 'access-list', 'in', acl_in])
- self.session.set(base_path + ['distribute-list', 'interface', interface, 'access-list', 'out', acl_out])
- self.session.set(base_path + ['distribute-list', 'interface', interface, 'prefix-list', 'in', prefix_list_in])
- self.session.set(base_path + ['distribute-list', 'interface', interface, 'prefix-list', 'out', prefix_list_out])
+ self.cli_set(base_path + ['interface', interface])
+ self.cli_set(base_path + ['distribute-list', 'interface', interface, 'access-list', 'in', acl_in])
+ self.cli_set(base_path + ['distribute-list', 'interface', interface, 'access-list', 'out', acl_out])
+ self.cli_set(base_path + ['distribute-list', 'interface', interface, 'prefix-list', 'in', prefix_list_in])
+ self.cli_set(base_path + ['distribute-list', 'interface', interface, 'prefix-list', 'out', prefix_list_out])
for network in networks:
- self.session.set(base_path + ['network', network])
- self.session.set(base_path + ['route', network])
+ self.cli_set(base_path + ['network', network])
+ self.cli_set(base_path + ['route', network])
for proto in redistribute:
- self.session.set(base_path + ['redistribute', proto, 'metric', metric])
- self.session.set(base_path + ['redistribute', proto, 'route-map', route_map])
+ self.cli_set(base_path + ['redistribute', proto, 'metric', metric])
+ self.cli_set(base_path + ['redistribute', proto, 'route-map', route_map])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR ospfd configuration
- frrconfig = getFRRconfig()
+ frrconfig = self.getFRRconfig('router ripng')
self.assertIn(f'router ripng', frrconfig)
self.assertIn(f' default-information originate', frrconfig)
self.assertIn(f' default-metric {metric}', frrconfig)
diff --git a/smoketest/scripts/cli/test_protocols_rpki.py b/smoketest/scripts/cli/test_protocols_rpki.py
index bec4ef76f..8212e9469 100755
--- a/smoketest/scripts/cli/test_protocols_rpki.py
+++ b/smoketest/scripts/cli/test_protocols_rpki.py
@@ -17,6 +17,8 @@
import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
from vyos.util import cmd
@@ -29,22 +31,15 @@ rpki_known_hosts = '/config/auth/known_hosts'
rpki_ssh_key = '/config/auth/id_rsa_rpki'
rpki_ssh_pub = f'{rpki_ssh_key}.pub'
-def getFRRRPKIconfig():
- return cmd(f'vtysh -c "show run" | sed -n "/rpki/,/^!/p"')
-
-class TestProtocolsRPKI(unittest.TestCase):
- def setUp(self):
- self.session = ConfigSession(os.getpid())
-
+class TestProtocolsRPKI(VyOSUnitTestSHIM.TestCase):
def tearDown(self):
- self.session.delete(base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(base_path)
+ self.cli_commit()
# Nothing RPKI specific should be left over in the config
#
# Disabled until T3266 is resolved
- # frrconfig = getFRRRPKIconfig()
+ # frrconfig = self.getFRRconfig('rpki')
# self.assertNotIn('rpki', frrconfig)
# Check for running process
@@ -71,16 +66,16 @@ class TestProtocolsRPKI(unittest.TestCase):
},
}
- self.session.set(base_path + ['polling-period', polling])
+ self.cli_set(base_path + ['polling-period', polling])
for peer, peer_config in cache.items():
- self.session.set(base_path + ['cache', peer, 'port', peer_config['port']])
- self.session.set(base_path + ['cache', peer, 'preference', peer_config['preference']])
+ self.cli_set(base_path + ['cache', peer, 'port', peer_config['port']])
+ self.cli_set(base_path + ['cache', peer, 'preference', peer_config['preference']])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR configuration
- frrconfig = getFRRRPKIconfig()
+ frrconfig = self.getFRRconfig('rpki')
self.assertIn(f'rpki polling_period {polling}', frrconfig)
for peer, peer_config in cache.items():
@@ -103,21 +98,21 @@ class TestProtocolsRPKI(unittest.TestCase):
},
}
- self.session.set(base_path + ['polling-period', polling])
+ self.cli_set(base_path + ['polling-period', polling])
for peer, peer_config in cache.items():
- self.session.set(base_path + ['cache', peer, 'port', peer_config['port']])
- self.session.set(base_path + ['cache', peer, 'preference', peer_config['preference']])
- self.session.set(base_path + ['cache', peer, 'ssh', 'username', peer_config['username']])
- self.session.set(base_path + ['cache', peer, 'ssh', 'public-key-file', rpki_ssh_pub])
- self.session.set(base_path + ['cache', peer, 'ssh', 'private-key-file', rpki_ssh_key])
- self.session.set(base_path + ['cache', peer, 'ssh', 'known-hosts-file', rpki_known_hosts])
+ self.cli_set(base_path + ['cache', peer, 'port', peer_config['port']])
+ self.cli_set(base_path + ['cache', peer, 'preference', peer_config['preference']])
+ self.cli_set(base_path + ['cache', peer, 'ssh', 'username', peer_config['username']])
+ self.cli_set(base_path + ['cache', peer, 'ssh', 'public-key-file', rpki_ssh_pub])
+ self.cli_set(base_path + ['cache', peer, 'ssh', 'private-key-file', rpki_ssh_key])
+ self.cli_set(base_path + ['cache', peer, 'ssh', 'known-hosts-file', rpki_known_hosts])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR configuration
- frrconfig = getFRRRPKIconfig()
+ frrconfig = self.getFRRconfig('rpki')
self.assertIn(f'rpki polling_period {polling}', frrconfig)
for peer, peer_config in cache.items():
@@ -140,12 +135,12 @@ class TestProtocolsRPKI(unittest.TestCase):
}
for peer, peer_config in cache.items():
- self.session.set(base_path + ['cache', peer, 'port', peer_config['port']])
- self.session.set(base_path + ['cache', peer, 'preference', peer_config['preference']])
+ self.cli_set(base_path + ['cache', peer, 'port', peer_config['port']])
+ self.cli_set(base_path + ['cache', peer, 'preference', peer_config['preference']])
# check validate() - preferences must be unique
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
if __name__ == '__main__':
diff --git a/smoketest/scripts/cli/test_protocols_static.py b/smoketest/scripts/cli/test_protocols_static.py
index cf591f060..75d3e6a42 100755
--- a/smoketest/scripts/cli/test_protocols_static.py
+++ b/smoketest/scripts/cli/test_protocols_static.py
@@ -14,23 +14,18 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
from vyos.template import is_ipv6
-from vyos.util import cmd
+from vyos.util import get_interface_config
base_path = ['protocols', 'static']
vrf_path = ['protocols', 'vrf']
-def getFRRCconfig(vrf=None):
- if vrf:
- return cmd(f'vtysh -c "show run" | sed -n "/^vrf {vrf}/,/^!/p"')
- else:
- return cmd(f'vtysh -c "show run" | sed -n "/^ip route/,/^!/p"')
-
routes = {
'10.0.0.0/8' : {
'next_hop' : {
@@ -85,28 +80,25 @@ routes = {
},
}
-vrfs = ['red', 'green', 'blue']
tables = ['80', '81', '82']
-class StaticRouteTest(unittest.TestCase):
+class StaticRouteTest(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
+ # This is our "target" VRF when leaking routes:
+ self.cli_set(['vrf', 'name', 'black', 'table', '43210'])
def tearDown(self):
for route, route_config in routes.items():
route_type = 'route'
if is_ipv6(route):
route_type = 'route6'
- self.session.delete(base_path + [route_type, route])
-
- for vrf in vrfs:
- self.session.delete(vrf_path + [vrf])
+ self.cli_delete(base_path + [route_type, route])
for table in tables:
- self.session.delete(base_path + ['table', table])
+ self.cli_delete(base_path + ['table', table])
- self.session.commit()
- del self.session
+ tmp = self.getFRRconfig('', end='')
+ self.cli_commit()
def test_protocols_static(self):
for route, route_config in routes.items():
@@ -116,39 +108,39 @@ class StaticRouteTest(unittest.TestCase):
base = base_path + [route_type, route]
if 'next_hop' in route_config:
for next_hop, next_hop_config in route_config['next_hop'].items():
- self.session.set(base + ['next-hop', next_hop])
+ self.cli_set(base + ['next-hop', next_hop])
if 'disable' in next_hop_config:
- self.session.set(base + ['next-hop', next_hop, 'disable'])
+ self.cli_set(base + ['next-hop', next_hop, 'disable'])
if 'distance' in next_hop_config:
- self.session.set(base + ['next-hop', next_hop, 'distance', next_hop_config['distance']])
+ self.cli_set(base + ['next-hop', next_hop, 'distance', next_hop_config['distance']])
if 'interface' in next_hop_config:
- self.session.set(base + ['next-hop', next_hop, 'interface', next_hop_config['interface']])
+ self.cli_set(base + ['next-hop', next_hop, 'interface', next_hop_config['interface']])
if 'vrf' in next_hop_config:
- self.session.set(base + ['next-hop', next_hop, 'vrf', next_hop_config['vrf']])
+ self.cli_set(base + ['next-hop', next_hop, 'vrf', next_hop_config['vrf']])
if 'interface' in route_config:
for interface, interface_config in route_config['interface'].items():
- self.session.set(base + ['interface', interface])
+ self.cli_set(base + ['interface', interface])
if 'disable' in interface_config:
- self.session.set(base + ['interface', interface, 'disable'])
+ self.cli_set(base + ['interface', interface, 'disable'])
if 'distance' in interface_config:
- self.session.set(base + ['interface', interface, 'distance', interface_config['distance']])
+ self.cli_set(base + ['interface', interface, 'distance', interface_config['distance']])
if 'vrf' in interface_config:
- self.session.set(base + ['interface', interface, 'vrf', interface_config['vrf']])
+ self.cli_set(base + ['interface', interface, 'vrf', interface_config['vrf']])
if 'blackhole' in route_config:
- self.session.set(base + ['blackhole'])
+ self.cli_set(base + ['blackhole'])
if 'distance' in route_config['blackhole']:
- self.session.set(base + ['blackhole', 'distance', route_config['blackhole']['distance']])
+ self.cli_set(base + ['blackhole', 'distance', route_config['blackhole']['distance']])
if 'tag' in route_config['blackhole']:
- self.session.set(base + ['blackhole', 'tag', route_config['blackhole']['tag']])
+ self.cli_set(base + ['blackhole', 'tag', route_config['blackhole']['tag']])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR bgpd configuration
- frrconfig = getFRRCconfig()
+ frrconfig = self.getFRRconfig('ip route', end='')
# Verify routes
for route, route_config in routes.items():
@@ -205,39 +197,39 @@ class StaticRouteTest(unittest.TestCase):
if 'next_hop' in route_config:
for next_hop, next_hop_config in route_config['next_hop'].items():
- self.session.set(base + ['next-hop', next_hop])
+ self.cli_set(base + ['next-hop', next_hop])
if 'disable' in next_hop_config:
- self.session.set(base + ['next-hop', next_hop, 'disable'])
+ self.cli_set(base + ['next-hop', next_hop, 'disable'])
if 'distance' in next_hop_config:
- self.session.set(base + ['next-hop', next_hop, 'distance', next_hop_config['distance']])
+ self.cli_set(base + ['next-hop', next_hop, 'distance', next_hop_config['distance']])
if 'interface' in next_hop_config:
- self.session.set(base + ['next-hop', next_hop, 'interface', next_hop_config['interface']])
+ self.cli_set(base + ['next-hop', next_hop, 'interface', next_hop_config['interface']])
if 'vrf' in next_hop_config:
- self.session.set(base + ['next-hop', next_hop, 'vrf', next_hop_config['vrf']])
+ self.cli_set(base + ['next-hop', next_hop, 'vrf', next_hop_config['vrf']])
if 'interface' in route_config:
for interface, interface_config in route_config['interface'].items():
- self.session.set(base + ['interface', interface])
+ self.cli_set(base + ['interface', interface])
if 'disable' in interface_config:
- self.session.set(base + ['interface', interface, 'disable'])
+ self.cli_set(base + ['interface', interface, 'disable'])
if 'distance' in interface_config:
- self.session.set(base + ['interface', interface, 'distance', interface_config['distance']])
+ self.cli_set(base + ['interface', interface, 'distance', interface_config['distance']])
if 'vrf' in interface_config:
- self.session.set(base + ['interface', interface, 'vrf', interface_config['vrf']])
+ self.cli_set(base + ['interface', interface, 'vrf', interface_config['vrf']])
if 'blackhole' in route_config:
- self.session.set(base + ['blackhole'])
+ self.cli_set(base + ['blackhole'])
if 'distance' in route_config['blackhole']:
- self.session.set(base + ['blackhole', 'distance', route_config['blackhole']['distance']])
+ self.cli_set(base + ['blackhole', 'distance', route_config['blackhole']['distance']])
if 'tag' in route_config['blackhole']:
- self.session.set(base + ['blackhole', 'tag', route_config['blackhole']['tag']])
+ self.cli_set(base + ['blackhole', 'tag', route_config['blackhole']['tag']])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify FRR bgpd configuration
- frrconfig = getFRRCconfig()
+ frrconfig = self.getFRRconfig('ip route', end='')
for table in tables:
# Verify routes
@@ -290,49 +282,67 @@ class StaticRouteTest(unittest.TestCase):
def test_protocols_vrf_static(self):
- for vrf in vrfs:
+ # Create VRF instances and apply the static routes from above to FRR.
+ # Re-read the configured routes and match them if they are programmed
+ # properly. This also includes VRF leaking
+ vrfs = {
+ 'red' : { 'table' : '1000' },
+ 'green' : { 'table' : '2000' },
+ 'blue' : { 'table' : '3000' },
+ }
+
+ for vrf, vrf_config in vrfs.items():
+ vrf_base_path = ['vrf', 'name', vrf]
+ self.cli_set(vrf_base_path + ['table', vrf_config['table']])
+
for route, route_config in routes.items():
route_type = 'route'
if is_ipv6(route):
route_type = 'route6'
- base = vrf_path + [vrf, 'static', route_type, route]
+ route_base_path = vrf_base_path + ['protocols', 'static', route_type, route]
if 'next_hop' in route_config:
for next_hop, next_hop_config in route_config['next_hop'].items():
- self.session.set(base + ['next-hop', next_hop])
+ self.cli_set(route_base_path + ['next-hop', next_hop])
if 'disable' in next_hop_config:
- self.session.set(base + ['next-hop', next_hop, 'disable'])
+ self.cli_set(route_base_path + ['next-hop', next_hop, 'disable'])
if 'distance' in next_hop_config:
- self.session.set(base + ['next-hop', next_hop, 'distance', next_hop_config['distance']])
+ self.cli_set(route_base_path + ['next-hop', next_hop, 'distance', next_hop_config['distance']])
if 'interface' in next_hop_config:
- self.session.set(base + ['next-hop', next_hop, 'interface', next_hop_config['interface']])
+ self.cli_set(route_base_path + ['next-hop', next_hop, 'interface', next_hop_config['interface']])
if 'vrf' in next_hop_config:
- self.session.set(base + ['next-hop', next_hop, 'vrf', next_hop_config['vrf']])
+ self.cli_set(route_base_path + ['next-hop', next_hop, 'vrf', next_hop_config['vrf']])
if 'interface' in route_config:
for interface, interface_config in route_config['interface'].items():
- self.session.set(base + ['interface', interface])
+ self.cli_set(route_base_path + ['interface', interface])
if 'disable' in interface_config:
- self.session.set(base + ['interface', interface, 'disable'])
+ self.cli_set(route_base_path + ['interface', interface, 'disable'])
if 'distance' in interface_config:
- self.session.set(base + ['interface', interface, 'distance', interface_config['distance']])
+ self.cli_set(route_base_path + ['interface', interface, 'distance', interface_config['distance']])
if 'vrf' in interface_config:
- self.session.set(base + ['interface', interface, 'vrf', interface_config['vrf']])
+ self.cli_set(route_base_path + ['interface', interface, 'vrf', interface_config['vrf']])
if 'blackhole' in route_config:
- self.session.set(base + ['blackhole'])
+ self.cli_set(route_base_path + ['blackhole'])
if 'distance' in route_config['blackhole']:
- self.session.set(base + ['blackhole', 'distance', route_config['blackhole']['distance']])
+ self.cli_set(route_base_path + ['blackhole', 'distance', route_config['blackhole']['distance']])
if 'tag' in route_config['blackhole']:
- self.session.set(base + ['blackhole', 'tag', route_config['blackhole']['tag']])
+ self.cli_set(route_base_path + ['blackhole', 'tag', route_config['blackhole']['tag']])
# commit changes
- self.session.commit()
+ self.cli_commit()
+
+ for vrf, vrf_config in vrfs.items():
+ tmp = get_interface_config(vrf)
+
+ # Compare VRF table ID
+ self.assertEqual(tmp['linkinfo']['info_data']['table'], int(vrf_config['table']))
+ self.assertEqual(tmp['linkinfo']['info_kind'], 'vrf')
- for vrf in vrfs:
# Verify FRR bgpd configuration
- frrconfig = getFRRCconfig(vrf)
+ frrconfig = self.getFRRconfig(f'vrf {vrf}')
self.assertIn(f'vrf {vrf}', frrconfig)
# Verify routes
@@ -380,6 +390,7 @@ class StaticRouteTest(unittest.TestCase):
self.assertIn(tmp, frrconfig)
+ self.cli_delete(['vrf'])
if __name__ == '__main__':
unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_service_bcast-relay.py b/smoketest/scripts/cli/test_service_bcast-relay.py
index 00d7750aa..58b730ab4 100755
--- a/smoketest/scripts/cli/test_service_bcast-relay.py
+++ b/smoketest/scripts/cli/test_service_bcast-relay.py
@@ -14,46 +14,46 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from psutil import process_iter
-from vyos.configsession import ConfigSession, ConfigSessionError
+from vyos.configsession import ConfigSession
+from vyos.configsession import ConfigSessionError
base_path = ['service', 'broadcast-relay']
-class TestServiceBroadcastRelay(unittest.TestCase):
+class TestServiceBroadcastRelay(VyOSUnitTestSHIM.TestCase):
_address1 = '192.0.2.1/24'
_address2 = '192.0.2.1/24'
def setUp(self):
- self.session = ConfigSession(os.getpid())
- self.session.set(['interfaces', 'dummy', 'dum1001', 'address', self._address1])
- self.session.set(['interfaces', 'dummy', 'dum1002', 'address', self._address2])
+ self.cli_set(['interfaces', 'dummy', 'dum1001', 'address', self._address1])
+ self.cli_set(['interfaces', 'dummy', 'dum1002', 'address', self._address2])
def tearDown(self):
- self.session.delete(['interfaces', 'dummy', 'dum1001'])
- self.session.delete(['interfaces', 'dummy', 'dum1002'])
- self.session.delete(base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(['interfaces', 'dummy', 'dum1001'])
+ self.cli_delete(['interfaces', 'dummy', 'dum1002'])
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_broadcast_relay_service(self):
ids = range(1, 5)
for id in ids:
base = base_path + ['id', str(id)]
- self.session.set(base + ['description', 'vyos'])
- self.session.set(base + ['port', str(10000 + id)])
+ self.cli_set(base + ['description', 'vyos'])
+ self.cli_set(base + ['port', str(10000 + id)])
# check validate() - two interfaces must be present
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
- self.session.set(base + ['interface', 'dum1001'])
- self.session.set(base + ['interface', 'dum1002'])
- self.session.set(base + ['address', self._address1.split('/')[0]])
+ self.cli_set(base + ['interface', 'dum1001'])
+ self.cli_set(base + ['interface', 'dum1002'])
+ self.cli_set(base + ['address', self._address1.split('/')[0]])
- self.session.commit()
+ self.cli_commit()
for id in ids:
# check if process is running
diff --git a/smoketest/scripts/cli/test_service_dhcp-relay.py b/smoketest/scripts/cli/test_service_dhcp-relay.py
index 676c4a481..db2edba54 100755
--- a/smoketest/scripts/cli/test_service_dhcp-relay.py
+++ b/smoketest/scripts/cli/test_service_dhcp-relay.py
@@ -14,14 +14,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import re
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
from vyos.ifconfig import Section
-from vyos.util import cmd
from vyos.util import process_named_running
from vyos.util import read_file
@@ -29,14 +28,10 @@ PROCESS_NAME = 'dhcrelay'
RELAY_CONF = '/run/dhcp-relay/dhcrelay.conf'
base_path = ['service', 'dhcp-relay']
-class TestServiceDHCPRelay(unittest.TestCase):
- def setUp(self):
- self.session = ConfigSession(os.getpid())
-
+class TestServiceDHCPRelay(VyOSUnitTestSHIM.TestCase):
def tearDown(self):
- self.session.delete(base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_relay_default(self):
max_size = '800'
@@ -44,28 +39,28 @@ class TestServiceDHCPRelay(unittest.TestCase):
agents_packets = 'append'
servers = ['192.0.2.1', '192.0.2.2']
- self.session.set(base_path + ['interface', 'lo'])
+ self.cli_set(base_path + ['interface', 'lo'])
# check validate() - DHCP relay does not support the loopback interface
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(base_path + ['interface', 'lo'])
+ self.cli_commit()
+ self.cli_delete(base_path + ['interface', 'lo'])
# activate DHCP relay on all ethernet interfaces
for tmp in Section.interfaces("ethernet"):
- self.session.set(base_path + ['interface', tmp])
+ self.cli_set(base_path + ['interface', tmp])
# check validate() - No DHCP relay server(s) configured
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
for server in servers:
- self.session.set(base_path + ['server', server])
+ self.cli_set(base_path + ['server', server])
- self.session.set(base_path + ['relay-options', 'max-size', max_size])
- self.session.set(base_path + ['relay-options', 'hop-count', hop_count])
- self.session.set(base_path + ['relay-options', 'relay-agents-packets', agents_packets])
+ self.cli_set(base_path + ['relay-options', 'max-size', max_size])
+ self.cli_set(base_path + ['relay-options', 'hop-count', hop_count])
+ self.cli_set(base_path + ['relay-options', 'relay-agents-packets', agents_packets])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Check configured port
config = read_file(RELAY_CONF)
diff --git a/smoketest/scripts/cli/test_service_dhcp-server.py b/smoketest/scripts/cli/test_service_dhcp-server.py
index e74e22a5c..d3f6f21f1 100755
--- a/smoketest/scripts/cli/test_service_dhcp-server.py
+++ b/smoketest/scripts/cli/test_service_dhcp-server.py
@@ -14,13 +14,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import re
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
-from vyos.util import cmd
from vyos.util import process_named_running
from vyos.util import read_file
from vyos.template import address_from_cidr
@@ -37,17 +36,15 @@ dns_1 = inc_ip(subnet, 2)
dns_2 = inc_ip(subnet, 3)
domain_name = 'vyos.net'
-class TestServiceDHCPServer(unittest.TestCase):
+class TestServiceDHCPServer(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
cidr_mask = subnet.split('/')[-1]
- self.session.set(['interfaces', 'dummy', 'dum8765', 'address', f'{router}/{cidr_mask}'])
+ self.cli_set(['interfaces', 'dummy', 'dum8765', 'address', f'{router}/{cidr_mask}'])
def tearDown(self):
- self.session.delete(['interfaces', 'dummy', 'dum8765'])
- self.session.delete(base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(['interfaces', 'dummy', 'dum8765'])
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_dhcp_single_pool_range(self):
shared_net_name = 'SMOKE-1'
@@ -57,25 +54,25 @@ class TestServiceDHCPServer(unittest.TestCase):
range_1_start = inc_ip(subnet, 40)
range_1_stop = inc_ip(subnet, 50)
- self.session.set(base_path + ['dynamic-dns-update'])
+ self.cli_set(base_path + ['dynamic-dns-update'])
pool = base_path + ['shared-network-name', shared_net_name, 'subnet', subnet]
# we use the first subnet IP address as default gateway
- self.session.set(pool + ['default-router', router])
- self.session.set(pool + ['dns-server', dns_1])
- self.session.set(pool + ['dns-server', dns_2])
- self.session.set(pool + ['domain-name', domain_name])
+ self.cli_set(pool + ['default-router', router])
+ self.cli_set(pool + ['dns-server', dns_1])
+ self.cli_set(pool + ['dns-server', dns_2])
+ self.cli_set(pool + ['domain-name', domain_name])
# check validate() - No DHCP address range or active static-mapping set
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(pool + ['range', '0', 'start', range_0_start])
- self.session.set(pool + ['range', '0', 'stop', range_0_stop])
- self.session.set(pool + ['range', '1', 'start', range_1_start])
- self.session.set(pool + ['range', '1', 'stop', range_1_stop])
+ self.cli_commit()
+ self.cli_set(pool + ['range', '0', 'start', range_0_start])
+ self.cli_set(pool + ['range', '0', 'stop', range_0_stop])
+ self.cli_set(pool + ['range', '1', 'start', range_1_start])
+ self.cli_set(pool + ['range', '1', 'stop', range_1_stop])
# commit changes
- self.session.commit()
+ self.cli_commit()
config = read_file(DHCPD_CONF)
network = address_from_cidr(subnet)
@@ -110,42 +107,42 @@ class TestServiceDHCPServer(unittest.TestCase):
pool = base_path + ['shared-network-name', shared_net_name, 'subnet', subnet]
# we use the first subnet IP address as default gateway
- self.session.set(pool + ['default-router', router])
- self.session.set(pool + ['dns-server', dns_1])
- self.session.set(pool + ['dns-server', dns_2])
- self.session.set(pool + ['domain-name', domain_name])
- self.session.set(pool + ['ip-forwarding'])
- self.session.set(pool + ['smtp-server', smtp_server])
- self.session.set(pool + ['pop-server', smtp_server])
- self.session.set(pool + ['time-server', time_server])
- self.session.set(pool + ['tftp-server-name', tftp_server])
+ self.cli_set(pool + ['default-router', router])
+ self.cli_set(pool + ['dns-server', dns_1])
+ self.cli_set(pool + ['dns-server', dns_2])
+ self.cli_set(pool + ['domain-name', domain_name])
+ self.cli_set(pool + ['ip-forwarding'])
+ self.cli_set(pool + ['smtp-server', smtp_server])
+ self.cli_set(pool + ['pop-server', smtp_server])
+ self.cli_set(pool + ['time-server', time_server])
+ self.cli_set(pool + ['tftp-server-name', tftp_server])
for search in search_domains:
- self.session.set(pool + ['domain-search', search])
- self.session.set(pool + ['bootfile-name', bootfile_name])
- self.session.set(pool + ['bootfile-server', bootfile_server])
- self.session.set(pool + ['wpad-url', wpad])
- self.session.set(pool + ['server-identifier', server_identifier])
+ self.cli_set(pool + ['domain-search', search])
+ self.cli_set(pool + ['bootfile-name', bootfile_name])
+ self.cli_set(pool + ['bootfile-server', bootfile_server])
+ self.cli_set(pool + ['wpad-url', wpad])
+ self.cli_set(pool + ['server-identifier', server_identifier])
- self.session.set(pool + ['static-route', 'destination-subnet', '10.0.0.0/24'])
- self.session.set(pool + ['static-route', 'router', '192.0.2.1'])
+ self.cli_set(pool + ['static-route', 'destination-subnet', '10.0.0.0/24'])
+ self.cli_set(pool + ['static-route', 'router', '192.0.2.1'])
# check validate() - No DHCP address range or active static-mapping set
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(pool + ['range', '0', 'start', range_0_start])
- self.session.set(pool + ['range', '0', 'stop', range_0_stop])
+ self.cli_commit()
+ self.cli_set(pool + ['range', '0', 'start', range_0_start])
+ self.cli_set(pool + ['range', '0', 'stop', range_0_stop])
# failover
failover_local = router
failover_remote = inc_ip(router, 1)
- self.session.set(pool + ['failover', 'local-address', failover_local])
- self.session.set(pool + ['failover', 'name', shared_net_name])
- self.session.set(pool + ['failover', 'peer-address', failover_remote])
- self.session.set(pool + ['failover', 'status', 'primary'])
+ self.cli_set(pool + ['failover', 'local-address', failover_local])
+ self.cli_set(pool + ['failover', 'name', shared_net_name])
+ self.cli_set(pool + ['failover', 'peer-address', failover_remote])
+ self.cli_set(pool + ['failover', 'status', 'primary'])
# commit changes
- self.session.commit()
+ self.cli_commit()
config = read_file(DHCPD_CONF)
@@ -204,24 +201,24 @@ class TestServiceDHCPServer(unittest.TestCase):
pool = base_path + ['shared-network-name', shared_net_name, 'subnet', subnet]
# we use the first subnet IP address as default gateway
- self.session.set(pool + ['default-router', router])
- self.session.set(pool + ['dns-server', dns_1])
- self.session.set(pool + ['dns-server', dns_2])
- self.session.set(pool + ['domain-name', domain_name])
+ self.cli_set(pool + ['default-router', router])
+ self.cli_set(pool + ['dns-server', dns_1])
+ self.cli_set(pool + ['dns-server', dns_2])
+ self.cli_set(pool + ['domain-name', domain_name])
# check validate() - No DHCP address range or active static-mapping set
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
client_base = 10
for client in ['client1', 'client2', 'client3']:
mac = '00:50:00:00:00:{}'.format(client_base)
- self.session.set(pool + ['static-mapping', client, 'mac-address', mac])
- self.session.set(pool + ['static-mapping', client, 'ip-address', inc_ip(subnet, client_base)])
+ self.cli_set(pool + ['static-mapping', client, 'mac-address', mac])
+ self.cli_set(pool + ['static-mapping', client, 'ip-address', inc_ip(subnet, client_base)])
client_base += 1
# commit changes
- self.session.commit()
+ self.cli_commit()
config = read_file(DHCPD_CONF)
network = address_from_cidr(subnet)
@@ -264,25 +261,25 @@ class TestServiceDHCPServer(unittest.TestCase):
pool = base_path + ['shared-network-name', shared_net_name, 'subnet', subnet]
# we use the first subnet IP address as default gateway
- self.session.set(pool + ['default-router', router])
- self.session.set(pool + ['dns-server', dns_1])
- self.session.set(pool + ['domain-name', domain_name])
- self.session.set(pool + ['lease', lease_time])
+ self.cli_set(pool + ['default-router', router])
+ self.cli_set(pool + ['dns-server', dns_1])
+ self.cli_set(pool + ['domain-name', domain_name])
+ self.cli_set(pool + ['lease', lease_time])
- self.session.set(pool + ['range', '0', 'start', range_0_start])
- self.session.set(pool + ['range', '0', 'stop', range_0_stop])
- self.session.set(pool + ['range', '1', 'start', range_1_start])
- self.session.set(pool + ['range', '1', 'stop', range_1_stop])
+ self.cli_set(pool + ['range', '0', 'start', range_0_start])
+ self.cli_set(pool + ['range', '0', 'stop', range_0_stop])
+ self.cli_set(pool + ['range', '1', 'start', range_1_start])
+ self.cli_set(pool + ['range', '1', 'stop', range_1_stop])
client_base = 60
for client in ['client1', 'client2', 'client3', 'client4']:
mac = '02:50:00:00:00:{}'.format(client_base)
- self.session.set(pool + ['static-mapping', client, 'mac-address', mac])
- self.session.set(pool + ['static-mapping', client, 'ip-address', inc_ip(subnet, client_base)])
+ self.cli_set(pool + ['static-mapping', client, 'mac-address', mac])
+ self.cli_set(pool + ['static-mapping', client, 'ip-address', inc_ip(subnet, client_base)])
client_base += 1
# commit changes
- self.session.commit()
+ self.cli_commit()
config = read_file(DHCPD_CONF)
for network in ['0', '1', '2', '3']:
@@ -329,13 +326,13 @@ class TestServiceDHCPServer(unittest.TestCase):
range_0_stop = inc_ip(subnet, 20)
pool = base_path + ['shared-network-name', 'EXCLUDE-TEST', 'subnet', subnet]
- self.session.set(pool + ['default-router', router])
- self.session.set(pool + ['exclude', router])
- self.session.set(pool + ['range', '0', 'start', range_0_start])
- self.session.set(pool + ['range', '0', 'stop', range_0_stop])
+ self.cli_set(pool + ['default-router', router])
+ self.cli_set(pool + ['exclude', router])
+ self.cli_set(pool + ['range', '0', 'start', range_0_start])
+ self.cli_set(pool + ['range', '0', 'stop', range_0_stop])
# commit changes
- self.session.commit()
+ self.cli_commit()
# VErify
config = read_file(DHCPD_CONF)
@@ -362,13 +359,13 @@ class TestServiceDHCPServer(unittest.TestCase):
range_0_start_excl = inc_ip(exclude_addr, 1)
pool = base_path + ['shared-network-name', 'EXCLUDE-TEST-2', 'subnet', subnet]
- self.session.set(pool + ['default-router', router])
- self.session.set(pool + ['exclude', exclude_addr])
- self.session.set(pool + ['range', '0', 'start', range_0_start])
- self.session.set(pool + ['range', '0', 'stop', range_0_stop])
+ self.cli_set(pool + ['default-router', router])
+ self.cli_set(pool + ['exclude', exclude_addr])
+ self.cli_set(pool + ['range', '0', 'start', range_0_start])
+ self.cli_set(pool + ['range', '0', 'stop', range_0_stop])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify
config = read_file(DHCPD_CONF)
@@ -386,7 +383,7 @@ class TestServiceDHCPServer(unittest.TestCase):
def test_dhcp_relay_server(self):
# Listen on specific address and return DHCP leases from a non
# directly connected pool
- self.session.set(base_path + ['listen-address', router])
+ self.cli_set(base_path + ['listen-address', router])
relay_subnet = '10.0.0.0/16'
relay_router = inc_ip(relay_subnet, 1)
@@ -395,12 +392,12 @@ class TestServiceDHCPServer(unittest.TestCase):
range_0_stop = '10.0.250.255'
pool = base_path + ['shared-network-name', 'RELAY', 'subnet', relay_subnet]
- self.session.set(pool + ['default-router', relay_router])
- self.session.set(pool + ['range', '0', 'start', range_0_start])
- self.session.set(pool + ['range', '0', 'stop', range_0_stop])
+ self.cli_set(pool + ['default-router', relay_router])
+ self.cli_set(pool + ['range', '0', 'start', range_0_start])
+ self.cli_set(pool + ['range', '0', 'stop', range_0_stop])
# commit changes
- self.session.commit()
+ self.cli_commit()
config = read_file(DHCPD_CONF)
network = address_from_cidr(subnet)
diff --git a/smoketest/scripts/cli/test_service_dhcpv6-relay.py b/smoketest/scripts/cli/test_service_dhcpv6-relay.py
index e36c237bc..5a9dd1aa6 100755
--- a/smoketest/scripts/cli/test_service_dhcpv6-relay.py
+++ b/smoketest/scripts/cli/test_service_dhcpv6-relay.py
@@ -14,15 +14,14 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import re
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
from vyos.ifconfig import Section
from vyos.template import address_from_cidr
-from vyos.util import cmd
from vyos.util import process_named_running
from vyos.util import read_file
@@ -35,52 +34,50 @@ upstream_if_addr = '2001:db8::1/64'
listen_addr = '2001:db8:ffff::1/64'
interfaces = []
-class TestServiceDHCPv6Relay(unittest.TestCase):
+class TestServiceDHCPv6Relay(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
for tmp in interfaces:
listen = listen_addr
if tmp == upstream_if:
listen = upstream_if_addr
- self.session.set(['interfaces', 'ethernet', tmp, 'address', listen])
+ self.cli_set(['interfaces', 'ethernet', tmp, 'address', listen])
def tearDown(self):
- self.session.delete(base_path)
+ self.cli_delete(base_path)
for tmp in interfaces:
listen = listen_addr
if tmp == upstream_if:
listen = upstream_if_addr
- self.session.delete(['interfaces', 'ethernet', tmp, 'address', listen])
+ self.cli_delete(['interfaces', 'ethernet', tmp, 'address', listen])
- self.session.commit()
- del self.session
+ self.cli_commit()
def test_relay_default(self):
dhcpv6_server = '2001:db8::ffff'
hop_count = '20'
- self.session.set(base_path + ['use-interface-id-option'])
- self.session.set(base_path + ['max-hop-count', hop_count])
+ self.cli_set(base_path + ['use-interface-id-option'])
+ self.cli_set(base_path + ['max-hop-count', hop_count])
# check validate() - Must set at least one listen and upstream
# interface addresses.
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(base_path + ['upstream-interface', upstream_if, 'address', dhcpv6_server])
+ self.cli_commit()
+ self.cli_set(base_path + ['upstream-interface', upstream_if, 'address', dhcpv6_server])
# check validate() - Must set at least one listen and upstream
# interface addresses.
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
# add listener on all ethernet interfaces except the upstream interface
for tmp in interfaces:
if tmp == upstream_if:
continue
- self.session.set(base_path + ['listen-interface', tmp, 'address', listen_addr.split('/')[0]])
+ self.cli_set(base_path + ['listen-interface', tmp, 'address', listen_addr.split('/')[0]])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Check configured port
config = read_file(RELAY_CONF)
diff --git a/smoketest/scripts/cli/test_service_dhcpv6-server.py b/smoketest/scripts/cli/test_service_dhcpv6-server.py
index a364eee11..e85a055c7 100755
--- a/smoketest/scripts/cli/test_service_dhcpv6-server.py
+++ b/smoketest/scripts/cli/test_service_dhcpv6-server.py
@@ -14,14 +14,13 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import re
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
from vyos.template import inc_ip
-from vyos.util import cmd
from vyos.util import process_named_running
from vyos.util import read_file
@@ -37,16 +36,14 @@ nis_servers = ['2001:db8:ffff::1', '2001:db8:ffff::2']
interface = 'eth1'
interface_addr = inc_ip(subnet, 1) + '/64'
-class TestServiceDHCPServer(unittest.TestCase):
+class TestServiceDHCPServer(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
- self.session.set(['interfaces', 'ethernet', interface, 'address', interface_addr])
+ self.cli_set(['interfaces', 'ethernet', interface, 'address', interface_addr])
def tearDown(self):
- self.session.delete(base_path)
- self.session.delete(['interfaces', 'ethernet', interface, 'address', interface_addr])
- self.session.commit()
- del self.session
+ self.cli_delete(base_path)
+ self.cli_delete(['interfaces', 'ethernet', interface, 'address', interface_addr])
+ self.cli_commit()
def test_single_pool(self):
shared_net_name = 'SMOKE-1'
@@ -62,37 +59,37 @@ class TestServiceDHCPServer(unittest.TestCase):
pool = base_path + ['shared-network-name', shared_net_name, 'subnet', subnet]
- self.session.set(base_path + ['preference', preference])
+ self.cli_set(base_path + ['preference', preference])
# we use the first subnet IP address as default gateway
- self.session.set(pool + ['name-server', dns_1])
- self.session.set(pool + ['name-server', dns_2])
- self.session.set(pool + ['name-server', dns_2])
- self.session.set(pool + ['lease-time', 'default', lease_time])
- self.session.set(pool + ['lease-time', 'maximum', max_lease_time])
- self.session.set(pool + ['lease-time', 'minimum', min_lease_time])
- self.session.set(pool + ['nis-domain', domain])
- self.session.set(pool + ['nisplus-domain', domain])
- self.session.set(pool + ['sip-server', sip_server])
- self.session.set(pool + ['sntp-server', sntp_server])
- self.session.set(pool + ['address-range', 'start', range_start, 'stop', range_stop])
+ self.cli_set(pool + ['name-server', dns_1])
+ self.cli_set(pool + ['name-server', dns_2])
+ self.cli_set(pool + ['name-server', dns_2])
+ self.cli_set(pool + ['lease-time', 'default', lease_time])
+ self.cli_set(pool + ['lease-time', 'maximum', max_lease_time])
+ self.cli_set(pool + ['lease-time', 'minimum', min_lease_time])
+ self.cli_set(pool + ['nis-domain', domain])
+ self.cli_set(pool + ['nisplus-domain', domain])
+ self.cli_set(pool + ['sip-server', sip_server])
+ self.cli_set(pool + ['sntp-server', sntp_server])
+ self.cli_set(pool + ['address-range', 'start', range_start, 'stop', range_stop])
for server in nis_servers:
- self.session.set(pool + ['nis-server', server])
- self.session.set(pool + ['nisplus-server', server])
+ self.cli_set(pool + ['nis-server', server])
+ self.cli_set(pool + ['nisplus-server', server])
for search in search_domains:
- self.session.set(pool + ['domain-search', search])
+ self.cli_set(pool + ['domain-search', search])
client_base = 1
for client in ['client1', 'client2', 'client3']:
cid = '00:01:00:01:12:34:56:78:aa:bb:cc:dd:ee:{}'.format(client_base)
- self.session.set(pool + ['static-mapping', client, 'identifier', cid])
- self.session.set(pool + ['static-mapping', client, 'ipv6-address', inc_ip(subnet, client_base)])
+ self.cli_set(pool + ['static-mapping', client, 'identifier', cid])
+ self.cli_set(pool + ['static-mapping', client, 'ipv6-address', inc_ip(subnet, client_base)])
client_base += 1
# commit changes
- self.session.commit()
+ self.cli_commit()
config = read_file(DHCPD_CONF)
self.assertIn(f'option dhcp6.preference {preference};', config)
@@ -136,12 +133,12 @@ class TestServiceDHCPServer(unittest.TestCase):
pool = base_path + ['shared-network-name', shared_net_name, 'subnet', subnet]
- self.session.set(pool + ['address-range', 'start', range_start, 'stop', range_stop])
- self.session.set(pool + ['prefix-delegation', 'start', delegate_start, 'stop', delegate_stop])
- self.session.set(pool + ['prefix-delegation', 'start', delegate_start, 'prefix-length', delegate_len])
+ self.cli_set(pool + ['address-range', 'start', range_start, 'stop', range_stop])
+ self.cli_set(pool + ['prefix-delegation', 'start', delegate_start, 'stop', delegate_stop])
+ self.cli_set(pool + ['prefix-delegation', 'start', delegate_start, 'prefix-length', delegate_len])
# commit changes
- self.session.commit()
+ self.cli_commit()
config = read_file(DHCPD_CONF)
self.assertIn(f'subnet6 {subnet}' + r' {', config)
@@ -156,12 +153,12 @@ class TestServiceDHCPServer(unittest.TestCase):
ns_global_1 = '2001:db8::1111'
ns_global_2 = '2001:db8::2222'
- self.session.set(base_path + ['global-parameters', 'name-server', ns_global_1])
- self.session.set(base_path + ['global-parameters', 'name-server', ns_global_2])
- self.session.set(base_path + ['shared-network-name', shared_net_name, 'subnet', subnet])
+ self.cli_set(base_path + ['global-parameters', 'name-server', ns_global_1])
+ self.cli_set(base_path + ['global-parameters', 'name-server', ns_global_2])
+ self.cli_set(base_path + ['shared-network-name', shared_net_name, 'subnet', subnet])
# commit changes
- self.session.commit()
+ self.cli_commit()
config = read_file(DHCPD_CONF)
self.assertIn(f'option dhcp6.name-servers {ns_global_1};', config)
diff --git a/smoketest/scripts/cli/test_service_dns_dynamic.py b/smoketest/scripts/cli/test_service_dns_dynamic.py
index 83eede64a..d8a87ffd4 100755
--- a/smoketest/scripts/cli/test_service_dns_dynamic.py
+++ b/smoketest/scripts/cli/test_service_dns_dynamic.py
@@ -18,10 +18,11 @@ import re
import os
import unittest
-from getpass import getuser
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
-from vyos.util import read_file
+from vyos.util import cmd
from vyos.util import process_named_running
PROCESS_NAME = 'ddclient'
@@ -29,21 +30,17 @@ DDCLIENT_CONF = '/run/ddclient/ddclient.conf'
base_path = ['service', 'dns', 'dynamic']
def get_config_value(key):
- tmp = read_file(DDCLIENT_CONF)
+ tmp = cmd(f'sudo cat {DDCLIENT_CONF}')
tmp = re.findall(r'\n?{}=+(.*)'.format(key), tmp)
tmp = tmp[0].rstrip(',')
return tmp
-class TestServiceDDNS(unittest.TestCase):
- def setUp(self):
- self.session = ConfigSession(os.getpid())
+class TestServiceDDNS(VyOSUnitTestSHIM.TestCase):
def tearDown(self):
# Delete DDNS configuration
- self.session.delete(base_path)
- self.session.commit()
-
- del self.session
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_dyndns_service(self):
ddns = ['interface', 'eth0', 'service']
@@ -53,45 +50,44 @@ class TestServiceDDNS(unittest.TestCase):
user = 'vyos_user'
password = 'vyos_pass'
zone = 'vyos.io'
- self.session.delete(base_path)
- self.session.set(base_path + ddns + [service, 'host-name', 'test.ddns.vyos.io'])
- self.session.set(base_path + ddns + [service, 'login', user])
- self.session.set(base_path + ddns + [service, 'password', password])
- self.session.set(base_path + ddns + [service, 'zone', zone])
+ self.cli_delete(base_path)
+ self.cli_set(base_path + ddns + [service, 'host-name', 'test.ddns.vyos.io'])
+ self.cli_set(base_path + ddns + [service, 'login', user])
+ self.cli_set(base_path + ddns + [service, 'password', password])
+ self.cli_set(base_path + ddns + [service, 'zone', zone])
# commit changes
if service == 'cloudflare':
- self.session.commit()
+ self.cli_commit()
else:
# zone option only works on cloudflare, an exception is raised
# for all others
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(base_path + ddns + [service, 'zone', 'vyos.io'])
+ self.cli_commit()
+ self.cli_delete(base_path + ddns + [service, 'zone', 'vyos.io'])
# commit changes again - now it should work
- self.session.commit()
+ self.cli_commit()
# we can only read the configuration file when we operate as 'root'
- if getuser() == 'root':
- protocol = get_config_value('protocol')
- login = get_config_value('login')
- pwd = get_config_value('password')
-
- # some services need special treatment
- protoname = service
- if service == 'cloudflare':
- tmp = get_config_value('zone')
- self.assertTrue(tmp == zone)
- elif service == 'afraid':
- protoname = 'freedns'
- elif service == 'dyndns':
- protoname = 'dyndns2'
- elif service == 'zoneedit':
- protoname = 'zoneedit1'
-
- self.assertTrue(protocol == protoname)
- self.assertTrue(login == user)
- self.assertTrue(pwd == "'" + password + "'")
+ protocol = get_config_value('protocol')
+ login = get_config_value('login')
+ pwd = get_config_value('password')
+
+ # some services need special treatment
+ protoname = service
+ if service == 'cloudflare':
+ tmp = get_config_value('zone')
+ self.assertTrue(tmp == zone)
+ elif service == 'afraid':
+ protoname = 'freedns'
+ elif service == 'dyndns':
+ protoname = 'dyndns2'
+ elif service == 'zoneedit':
+ protoname = 'zoneedit1'
+
+ self.assertTrue(protocol == protoname)
+ self.assertTrue(login == user)
+ self.assertTrue(pwd == "'" + password + "'")
# Check for running process
self.assertTrue(process_named_running(PROCESS_NAME))
@@ -101,11 +97,11 @@ class TestServiceDDNS(unittest.TestCase):
ddns = ['interface', 'eth0', 'rfc2136', 'vyos']
ddns_key_file = '/config/auth/my.key'
- self.session.set(base_path + ddns + ['key', ddns_key_file])
- self.session.set(base_path + ddns + ['record', 'test.ddns.vyos.io'])
- self.session.set(base_path + ddns + ['server', 'ns1.vyos.io'])
- self.session.set(base_path + ddns + ['ttl', '300'])
- self.session.set(base_path + ddns + ['zone', 'vyos.io'])
+ self.cli_set(base_path + ddns + ['key', ddns_key_file])
+ self.cli_set(base_path + ddns + ['record', 'test.ddns.vyos.io'])
+ self.cli_set(base_path + ddns + ['server', 'ns1.vyos.io'])
+ self.cli_set(base_path + ddns + ['ttl', '300'])
+ self.cli_set(base_path + ddns + ['zone', 'vyos.io'])
# ensure an exception will be raised as no key is present
if os.path.exists(ddns_key_file):
@@ -113,13 +109,13 @@ class TestServiceDDNS(unittest.TestCase):
# check validate() - the key file does not exist yet
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
with open(ddns_key_file, 'w') as f:
f.write('S3cretKey')
# commit changes
- self.session.commit()
+ self.cli_commit()
# TODO: inspect generated configuration file
diff --git a/smoketest/scripts/cli/test_service_dns_forwarding.py b/smoketest/scripts/cli/test_service_dns_forwarding.py
index ada53e8dd..8005eb319 100755
--- a/smoketest/scripts/cli/test_service_dns_forwarding.py
+++ b/smoketest/scripts/cli/test_service_dns_forwarding.py
@@ -15,10 +15,12 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import re
-import os
import unittest
-from vyos.configsession import ConfigSession, ConfigSessionError
+from base_vyostest_shim import VyOSUnitTestSHIM
+
+from vyos.configsession import ConfigSession
+from vyos.configsession import ConfigSessionError
from vyos.util import read_file
from vyos.util import process_named_running
@@ -37,44 +39,40 @@ def get_config_value(key, file=CONFIG_FILE):
tmp = re.findall(r'\n{}=+(.*)'.format(key), tmp)
return tmp[0]
-class TestServicePowerDNS(unittest.TestCase):
- def setUp(self):
- self.session = ConfigSession(os.getpid())
-
+class TestServicePowerDNS(VyOSUnitTestSHIM.TestCase):
def tearDown(self):
# Delete DNS forwarding configuration
- self.session.delete(base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_basic_forwarding(self):
# Check basic DNS forwarding settings
cache_size = '20'
negative_ttl = '120'
- self.session.set(base_path + ['cache-size', cache_size])
- self.session.set(base_path + ['negative-ttl', negative_ttl])
+ self.cli_set(base_path + ['cache-size', cache_size])
+ self.cli_set(base_path + ['negative-ttl', negative_ttl])
# check validate() - allow from must be defined
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
for network in allow_from:
- self.session.set(base_path + ['allow-from', network])
+ self.cli_set(base_path + ['allow-from', network])
# check validate() - listen-address must be defined
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
for address in listen_adress:
- self.session.set(base_path + ['listen-address', address])
+ self.cli_set(base_path + ['listen-address', address])
# configure DNSSEC
- self.session.set(base_path + ['dnssec', 'validate'])
+ self.cli_set(base_path + ['dnssec', 'validate'])
# Do not use local /etc/hosts file in name resolution
- self.session.set(base_path + ['ignore-hosts-file'])
+ self.cli_set(base_path + ['ignore-hosts-file'])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Check configured cache-size
tmp = get_config_value('max-cache-entries')
@@ -103,16 +101,16 @@ class TestServicePowerDNS(unittest.TestCase):
# DNSSEC option testing
for network in allow_from:
- self.session.set(base_path + ['allow-from', network])
+ self.cli_set(base_path + ['allow-from', network])
for address in listen_adress:
- self.session.set(base_path + ['listen-address', address])
+ self.cli_set(base_path + ['listen-address', address])
options = ['off', 'process-no-validate', 'process', 'log-fail', 'validate']
for option in options:
- self.session.set(base_path + ['dnssec', option])
+ self.cli_set(base_path + ['dnssec', option])
# commit changes
- self.session.commit()
+ self.cli_commit()
tmp = get_config_value('dnssec')
self.assertEqual(tmp, option)
@@ -124,16 +122,16 @@ class TestServicePowerDNS(unittest.TestCase):
# Externe Domain Name Servers (DNS) addresses
for network in allow_from:
- self.session.set(base_path + ['allow-from', network])
+ self.cli_set(base_path + ['allow-from', network])
for address in listen_adress:
- self.session.set(base_path + ['listen-address', address])
+ self.cli_set(base_path + ['listen-address', address])
nameservers = ['192.0.2.1', '192.0.2.2']
for nameserver in nameservers:
- self.session.set(base_path + ['name-server', nameserver])
+ self.cli_set(base_path + ['name-server', nameserver])
# commit changes
- self.session.commit()
+ self.cli_commit()
tmp = get_config_value(r'\+.', file=FORWARD_FILE)
self.assertEqual(tmp, ', '.join(nameservers))
@@ -148,26 +146,26 @@ class TestServicePowerDNS(unittest.TestCase):
def test_domain_forwarding(self):
for network in allow_from:
- self.session.set(base_path + ['allow-from', network])
+ self.cli_set(base_path + ['allow-from', network])
for address in listen_adress:
- self.session.set(base_path + ['listen-address', address])
+ self.cli_set(base_path + ['listen-address', address])
domains = ['vyos.io', 'vyos.net', 'vyos.com']
nameservers = ['192.0.2.1', '192.0.2.2']
for domain in domains:
for nameserver in nameservers:
- self.session.set(base_path + ['domain', domain, 'server', nameserver])
+ self.cli_set(base_path + ['domain', domain, 'server', nameserver])
# Test 'recursion-desired' flag for only one domain
if domain == domains[0]:
- self.session.set(base_path + ['domain', domain, 'recursion-desired'])
+ self.cli_set(base_path + ['domain', domain, 'recursion-desired'])
# Test 'negative trust anchor' flag for the second domain only
if domain == domains[1]:
- self.session.set(base_path + ['domain', domain, 'addnta'])
+ self.cli_set(base_path + ['domain', domain, 'addnta'])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Test configured name-servers
hosts_conf = read_file(HOSTSD_FILE)
diff --git a/smoketest/scripts/cli/test_service_https.py b/smoketest/scripts/cli/test_service_https.py
index fd0f6bfbd..3ed7655e9 100755
--- a/smoketest/scripts/cli/test_service_https.py
+++ b/smoketest/scripts/cli/test_service_https.py
@@ -14,28 +14,27 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
from vyos.configsession import ConfigSession
from vyos.util import run
base_path = ['service', 'https']
-class TestHTTPSService(unittest.TestCase):
+class TestHTTPSService(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
# ensure we can also run this test on a live system - so lets clean
# out the current configuration :)
- self.session.delete(base_path)
+ self.cli_delete(base_path)
def tearDown(self):
- self.session.delete(base_path)
- self.session.commit()
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_default(self):
- self.session.set(base_path)
- self.session.commit()
+ self.cli_set(base_path)
+ self.cli_commit()
ret = run('sudo /usr/sbin/nginx -t')
self.assertEqual(ret, 0)
@@ -48,11 +47,11 @@ class TestHTTPSService(unittest.TestCase):
test_path = base_path + ['virtual-host', vhost_id]
- self.session.set(test_path + ['listen-address', address])
- self.session.set(test_path + ['listen-port', port])
- self.session.set(test_path + ['server-name', name])
+ self.cli_set(test_path + ['listen-address', address])
+ self.cli_set(test_path + ['listen-port', port])
+ self.cli_set(test_path + ['server-name', name])
- self.session.commit()
+ self.cli_commit()
ret = run('sudo /usr/sbin/nginx -t')
self.assertEqual(ret, 0)
diff --git a/smoketest/scripts/cli/test_service_mdns-repeater.py b/smoketest/scripts/cli/test_service_mdns-repeater.py
index e6986b92a..b1092c3e5 100755
--- a/smoketest/scripts/cli/test_service_mdns-repeater.py
+++ b/smoketest/scripts/cli/test_service_mdns-repeater.py
@@ -14,35 +14,32 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.util import process_named_running
base_path = ['service', 'mdns', 'repeater']
intf_base = ['interfaces', 'dummy']
-class TestServiceMDNSrepeater(unittest.TestCase):
- def setUp(self):
- self.session = ConfigSession(os.getpid())
-
+class TestServiceMDNSrepeater(VyOSUnitTestSHIM.TestCase):
def tearDown(self):
- self.session.delete(base_path)
- self.session.delete(intf_base + ['dum10'])
- self.session.delete(intf_base + ['dum20'])
- self.session.commit()
- del self.session
+ self.cli_delete(base_path)
+ self.cli_delete(intf_base + ['dum10'])
+ self.cli_delete(intf_base + ['dum20'])
+ self.cli_commit()
def test_service(self):
# Service required a configured IP address on the interface
- self.session.set(intf_base + ['dum10', 'address', '192.0.2.1/30'])
- self.session.set(intf_base + ['dum20', 'address', '192.0.2.5/30'])
+ self.cli_set(intf_base + ['dum10', 'address', '192.0.2.1/30'])
+ self.cli_set(intf_base + ['dum20', 'address', '192.0.2.5/30'])
- self.session.set(base_path + ['interface', 'dum10'])
- self.session.set(base_path + ['interface', 'dum20'])
- self.session.commit()
+ self.cli_set(base_path + ['interface', 'dum10'])
+ self.cli_set(base_path + ['interface', 'dum20'])
+ self.cli_commit()
# Check for running process
self.assertTrue(process_named_running('mdns-repeater'))
diff --git a/smoketest/scripts/cli/test_service_pppoe-server.py b/smoketest/scripts/cli/test_service_pppoe-server.py
index e8f9facbb..2b11ee362 100755
--- a/smoketest/scripts/cli/test_service_pppoe-server.py
+++ b/smoketest/scripts/cli/test_service_pppoe-server.py
@@ -27,7 +27,7 @@ local_if = ['interfaces', 'dummy', 'dum667']
ac_name = 'ACN'
interface = 'eth0'
-class TestServicePPPoEServer(BasicAccelPPPTest.BaseTest):
+class TestServicePPPoEServer(BasicAccelPPPTest.TestCase):
def setUp(self):
self._base_path = ['service', 'pppoe-server']
self._process_name = 'accel-pppd'
@@ -37,7 +37,7 @@ class TestServicePPPoEServer(BasicAccelPPPTest.BaseTest):
super().setUp()
def tearDown(self):
- self.session.delete(local_if)
+ self.cli_delete(local_if)
super().tearDown()
def verify(self, conf):
@@ -66,7 +66,7 @@ class TestServicePPPoEServer(BasicAccelPPPTest.BaseTest):
super().verify(conf)
def basic_config(self):
- self.session.set(local_if + ['address', '192.0.2.1/32'])
+ self.cli_set(local_if + ['address', '192.0.2.1/32'])
self.set(['access-concentrator', ac_name])
self.set(['interface', interface])
@@ -92,7 +92,7 @@ class TestServicePPPoEServer(BasicAccelPPPTest.BaseTest):
self.set(['ppp-options', 'mru', mru])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Validate configuration values
conf = ConfigParser(allow_no_value=True, delimiters='=')
@@ -124,7 +124,7 @@ class TestServicePPPoEServer(BasicAccelPPPTest.BaseTest):
self.set( ['authentication', 'protocols', 'mschap-v2'])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Validate configuration values
conf = ConfigParser(allow_no_value=True)
@@ -150,7 +150,7 @@ class TestServicePPPoEServer(BasicAccelPPPTest.BaseTest):
self.set(['client-ip-pool', 'stop', stop])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Validate configuration values
conf = ConfigParser(allow_no_value=True)
@@ -187,7 +187,7 @@ class TestServicePPPoEServer(BasicAccelPPPTest.BaseTest):
self.set(['client-ipv6-pool', 'delegate', delegate_prefix, 'delegation-prefix', delegate_mask])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Validate configuration values
conf = ConfigParser(allow_no_value=True, delimiters='=')
diff --git a/smoketest/scripts/cli/test_service_router-advert.py b/smoketest/scripts/cli/test_service_router-advert.py
index b80eb3c43..b19c49c6e 100755
--- a/smoketest/scripts/cli/test_service_router-advert.py
+++ b/smoketest/scripts/cli/test_service_router-advert.py
@@ -15,9 +15,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import re
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.util import read_file
from vyos.util import process_named_running
@@ -33,26 +34,24 @@ def get_config_value(key):
tmp = re.findall(r'\n?{}\s+(.*)'.format(key), tmp)
return tmp[0].split()[0].replace(';','')
-class TestServiceRADVD(unittest.TestCase):
+class TestServiceRADVD(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
- self.session.set(address_base + ['2001:db8::1/64'])
+ self.cli_set(address_base + ['2001:db8::1/64'])
def tearDown(self):
- self.session.delete(address_base)
- self.session.delete(base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(address_base)
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_single(self):
- self.session.set(base_path + ['prefix', '::/64', 'no-on-link-flag'])
- self.session.set(base_path + ['prefix', '::/64', 'no-autonomous-flag'])
- self.session.set(base_path + ['prefix', '::/64', 'valid-lifetime', 'infinity'])
- self.session.set(base_path + ['dnssl', '2001:db8::1234'])
- self.session.set(base_path + ['other-config-flag'])
+ self.cli_set(base_path + ['prefix', '::/64', 'no-on-link-flag'])
+ self.cli_set(base_path + ['prefix', '::/64', 'no-autonomous-flag'])
+ self.cli_set(base_path + ['prefix', '::/64', 'valid-lifetime', 'infinity'])
+ self.cli_set(base_path + ['dnssl', '2001:db8::1234'])
+ self.cli_set(base_path + ['other-config-flag'])
# commit changes
- self.session.commit()
+ self.cli_commit()
# verify values
tmp = get_config_value('interface')
diff --git a/smoketest/scripts/cli/test_service_snmp.py b/smoketest/scripts/cli/test_service_snmp.py
index 81045d0b4..008271102 100755
--- a/smoketest/scripts/cli/test_service_snmp.py
+++ b/smoketest/scripts/cli/test_service_snmp.py
@@ -14,10 +14,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import re
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
@@ -35,15 +35,11 @@ def get_config_value(key):
tmp = re.findall(r'\n?{}\s+(.*)'.format(key), tmp)
return tmp[0]
-class TestSNMPService(unittest.TestCase):
+class TestSNMPService(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
# ensure we can also run this test on a live system - so lets clean
# out the current configuration :)
- self.session.delete(base_path)
-
- def tearDown(self):
- del self.session
+ self.cli_delete(base_path)
def test_snmp_basic(self):
# Check if SNMP can be configured and service runs
@@ -53,19 +49,19 @@ class TestSNMPService(unittest.TestCase):
for auth in ['ro', 'rw']:
community = 'VyOS' + auth
- self.session.set(base_path + ['community', community, 'authorization', auth])
+ self.cli_set(base_path + ['community', community, 'authorization', auth])
for client in clients:
- self.session.set(base_path + ['community', community, 'client', client])
+ self.cli_set(base_path + ['community', community, 'client', client])
for network in networks:
- self.session.set(base_path + ['community', community, 'network', network])
+ self.cli_set(base_path + ['community', community, 'network', network])
for addr in listen:
- self.session.set(base_path + ['listen-address', addr])
+ self.cli_set(base_path + ['listen-address', addr])
- self.session.set(base_path + ['contact', 'maintainers@vyos.io'])
- self.session.set(base_path + ['location', 'qemu'])
+ self.cli_set(base_path + ['contact', 'maintainers@vyos.io'])
+ self.cli_set(base_path + ['location', 'qemu'])
- self.session.commit()
+ self.cli_commit()
# verify listen address, it will be returned as
# ['unix:/run/snmpd.socket,udp:127.0.0.1:161,udp6:[::1]:161']
@@ -88,30 +84,30 @@ class TestSNMPService(unittest.TestCase):
# Check if SNMPv3 can be configured with SHA authentication
# and service runs
- self.session.set(base_path + ['v3', 'engineid', '000000000000000000000002'])
- self.session.set(base_path + ['v3', 'group', 'default', 'mode', 'ro'])
+ self.cli_set(base_path + ['v3', 'engineid', '000000000000000000000002'])
+ self.cli_set(base_path + ['v3', 'group', 'default', 'mode', 'ro'])
# check validate() - a view must be created before this can be comitted
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
- self.session.set(base_path + ['v3', 'view', 'default', 'oid', '1'])
- self.session.set(base_path + ['v3', 'group', 'default', 'view', 'default'])
+ self.cli_set(base_path + ['v3', 'view', 'default', 'oid', '1'])
+ self.cli_set(base_path + ['v3', 'group', 'default', 'view', 'default'])
# create user
- self.session.set(base_path + ['v3', 'user', 'vyos', 'auth', 'plaintext-password', 'vyos12345678'])
- self.session.set(base_path + ['v3', 'user', 'vyos', 'auth', 'type', 'sha'])
- self.session.set(base_path + ['v3', 'user', 'vyos', 'privacy', 'plaintext-password', 'vyos12345678'])
- self.session.set(base_path + ['v3', 'user', 'vyos', 'privacy', 'type', 'aes'])
- self.session.set(base_path + ['v3', 'user', 'vyos', 'group', 'default'])
+ self.cli_set(base_path + ['v3', 'user', 'vyos', 'auth', 'plaintext-password', 'vyos12345678'])
+ self.cli_set(base_path + ['v3', 'user', 'vyos', 'auth', 'type', 'sha'])
+ self.cli_set(base_path + ['v3', 'user', 'vyos', 'privacy', 'plaintext-password', 'vyos12345678'])
+ self.cli_set(base_path + ['v3', 'user', 'vyos', 'privacy', 'type', 'aes'])
+ self.cli_set(base_path + ['v3', 'user', 'vyos', 'group', 'default'])
- self.session.commit()
+ self.cli_commit()
# commit will alter the CLI values - check if they have been updated:
hashed_password = '4e52fe55fd011c9c51ae2c65f4b78ca93dcafdfe'
- tmp = self.session.show_config(base_path + ['v3', 'user', 'vyos', 'auth', 'encrypted-password']).split()[1]
+ tmp = self._session.show_config(base_path + ['v3', 'user', 'vyos', 'auth', 'encrypted-password']).split()[1]
self.assertEqual(tmp, hashed_password)
- tmp = self.session.show_config(base_path + ['v3', 'user', 'vyos', 'privacy', 'encrypted-password']).split()[1]
+ tmp = self._session.show_config(base_path + ['v3', 'user', 'vyos', 'privacy', 'encrypted-password']).split()[1]
self.assertEqual(tmp, hashed_password)
# TODO: read in config file and check values
@@ -123,30 +119,30 @@ class TestSNMPService(unittest.TestCase):
# Check if SNMPv3 can be configured with MD5 authentication
# and service runs
- self.session.set(base_path + ['v3', 'engineid', '000000000000000000000002'])
- self.session.set(base_path + ['v3', 'group', 'default', 'mode', 'ro'])
+ self.cli_set(base_path + ['v3', 'engineid', '000000000000000000000002'])
+ self.cli_set(base_path + ['v3', 'group', 'default', 'mode', 'ro'])
# check validate() - a view must be created before this can be comitted
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
- self.session.set(base_path + ['v3', 'view', 'default', 'oid', '1'])
- self.session.set(base_path + ['v3', 'group', 'default', 'view', 'default'])
+ self.cli_set(base_path + ['v3', 'view', 'default', 'oid', '1'])
+ self.cli_set(base_path + ['v3', 'group', 'default', 'view', 'default'])
# create user
- self.session.set(base_path + ['v3', 'user', 'vyos', 'auth', 'plaintext-password', 'vyos12345678'])
- self.session.set(base_path + ['v3', 'user', 'vyos', 'auth', 'type', 'md5'])
- self.session.set(base_path + ['v3', 'user', 'vyos', 'privacy', 'plaintext-password', 'vyos12345678'])
- self.session.set(base_path + ['v3', 'user', 'vyos', 'privacy', 'type', 'des'])
- self.session.set(base_path + ['v3', 'user', 'vyos', 'group', 'default'])
+ self.cli_set(base_path + ['v3', 'user', 'vyos', 'auth', 'plaintext-password', 'vyos12345678'])
+ self.cli_set(base_path + ['v3', 'user', 'vyos', 'auth', 'type', 'md5'])
+ self.cli_set(base_path + ['v3', 'user', 'vyos', 'privacy', 'plaintext-password', 'vyos12345678'])
+ self.cli_set(base_path + ['v3', 'user', 'vyos', 'privacy', 'type', 'des'])
+ self.cli_set(base_path + ['v3', 'user', 'vyos', 'group', 'default'])
- self.session.commit()
+ self.cli_commit()
# commit will alter the CLI values - check if they have been updated:
hashed_password = '4c67690d45d3dfcd33d0d7e308e370ad'
- tmp = self.session.show_config(base_path + ['v3', 'user', 'vyos', 'auth', 'encrypted-password']).split()[1]
+ tmp = self._session.show_config(base_path + ['v3', 'user', 'vyos', 'auth', 'encrypted-password']).split()[1]
self.assertEqual(tmp, hashed_password)
- tmp = self.session.show_config(base_path + ['v3', 'user', 'vyos', 'privacy', 'encrypted-password']).split()[1]
+ tmp = self._session.show_config(base_path + ['v3', 'user', 'vyos', 'privacy', 'encrypted-password']).split()[1]
self.assertEqual(tmp, hashed_password)
# TODO: read in config file and check values
diff --git a/smoketest/scripts/cli/test_service_ssh.py b/smoketest/scripts/cli/test_service_ssh.py
index 68081e56f..c76f709b1 100755
--- a/smoketest/scripts/cli/test_service_ssh.py
+++ b/smoketest/scripts/cli/test_service_ssh.py
@@ -14,10 +14,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import re
import os
+import re
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
from vyos.util import cmd
@@ -38,18 +40,16 @@ def get_config_value(key):
tmp = re.findall(f'\n?{key}\s+(.*)', tmp)
return tmp
-class TestServiceSSH(unittest.TestCase):
+class TestServiceSSH(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
# ensure we can also run this test on a live system - so lets clean
# out the current configuration :)
- self.session.delete(base_path)
+ self.cli_delete(base_path)
def tearDown(self):
# delete testing SSH config
- self.session.delete(base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(base_path)
+ self.cli_commit()
self.assertTrue(os.path.isfile(key_rsa))
self.assertTrue(os.path.isfile(key_dsa))
@@ -58,10 +58,10 @@ class TestServiceSSH(unittest.TestCase):
def test_ssh_default(self):
# Check if SSH service runs with default settings - used for checking
# behavior of <defaultValue> in XML definition
- self.session.set(base_path)
+ self.cli_set(base_path)
# commit changes
- self.session.commit()
+ self.cli_commit()
# Check configured port
port = get_config_value('Port')[0]
@@ -72,15 +72,15 @@ class TestServiceSSH(unittest.TestCase):
def test_ssh_single_listen_address(self):
# Check if SSH service can be configured and runs
- self.session.set(base_path + ['port', '1234'])
- self.session.set(base_path + ['disable-host-validation'])
- self.session.set(base_path + ['disable-password-authentication'])
- self.session.set(base_path + ['loglevel', 'verbose'])
- self.session.set(base_path + ['client-keepalive-interval', '100'])
- self.session.set(base_path + ['listen-address', '127.0.0.1'])
+ self.cli_set(base_path + ['port', '1234'])
+ self.cli_set(base_path + ['disable-host-validation'])
+ self.cli_set(base_path + ['disable-password-authentication'])
+ self.cli_set(base_path + ['loglevel', 'verbose'])
+ self.cli_set(base_path + ['client-keepalive-interval', '100'])
+ self.cli_set(base_path + ['listen-address', '127.0.0.1'])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Check configured port
port = get_config_value('Port')[0]
@@ -114,14 +114,14 @@ class TestServiceSSH(unittest.TestCase):
# listen ports and listen-addresses
ports = ['22', '2222', '2223', '2224']
for port in ports:
- self.session.set(base_path + ['port', port])
+ self.cli_set(base_path + ['port', port])
addresses = ['127.0.0.1', '::1']
for address in addresses:
- self.session.set(base_path + ['listen-address', address])
+ self.cli_set(base_path + ['listen-address', address])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Check configured port
tmp = get_config_value('Port')
@@ -139,17 +139,17 @@ class TestServiceSSH(unittest.TestCase):
def test_ssh_vrf(self):
# Check if SSH service can be bound to given VRF
port = '22'
- self.session.set(base_path + ['port', port])
- self.session.set(base_path + ['vrf', vrf])
+ self.cli_set(base_path + ['port', port])
+ self.cli_set(base_path + ['vrf', vrf])
# VRF does yet not exist - an error must be thrown
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
- self.session.set(['vrf', 'name', vrf, 'table', '1338'])
+ self.cli_set(['vrf', 'name', vrf, 'table', '1338'])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Check configured port
tmp = get_config_value('Port')
@@ -163,7 +163,7 @@ class TestServiceSSH(unittest.TestCase):
self.assertIn(PROCESS_NAME, tmp)
# delete VRF
- self.session.delete(['vrf', 'name', vrf])
+ self.cli_delete(['vrf', 'name', vrf])
if __name__ == '__main__':
unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_service_tftp-server.py b/smoketest/scripts/cli/test_service_tftp-server.py
index 82e5811ff..aed4c6beb 100755
--- a/smoketest/scripts/cli/test_service_tftp-server.py
+++ b/smoketest/scripts/cli/test_service_tftp-server.py
@@ -14,11 +14,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import re
-import os
import unittest
from psutil import process_iter
+from base_vyostest_shim import VyOSUnitTestSHIM
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
@@ -32,28 +31,26 @@ dummy_if_path = ['interfaces', 'dummy', 'dum69']
address_ipv4 = '192.0.2.1'
address_ipv6 = '2001:db8::1'
-class TestServiceTFTPD(unittest.TestCase):
+class TestServiceTFTPD(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
- self.session.set(dummy_if_path + ['address', address_ipv4 + '/32'])
- self.session.set(dummy_if_path + ['address', address_ipv6 + '/128'])
+ self.cli_set(dummy_if_path + ['address', address_ipv4 + '/32'])
+ self.cli_set(dummy_if_path + ['address', address_ipv6 + '/128'])
def tearDown(self):
- self.session.delete(base_path)
- self.session.delete(dummy_if_path)
- self.session.commit()
- del self.session
+ self.cli_delete(base_path)
+ self.cli_delete(dummy_if_path)
+ self.cli_commit()
def test_01_tftpd_single(self):
directory = '/tmp'
port = '69' # default port
- self.session.set(base_path + ['allow-upload'])
- self.session.set(base_path + ['directory', directory])
- self.session.set(base_path + ['listen-address', address_ipv4])
+ self.cli_set(base_path + ['allow-upload'])
+ self.cli_set(base_path + ['directory', directory])
+ self.cli_set(base_path + ['listen-address', address_ipv4])
# commit changes
- self.session.commit()
+ self.cli_commit()
config = read_file('/etc/default/tftpd0')
# verify listen IP address
@@ -71,13 +68,13 @@ class TestServiceTFTPD(unittest.TestCase):
address = [address_ipv4, address_ipv6]
port = '70'
- self.session.set(base_path + ['directory', directory])
+ self.cli_set(base_path + ['directory', directory])
for addr in address:
- self.session.set(base_path + ['listen-address', addr])
- self.session.set(base_path + ['port', port])
+ self.cli_set(base_path + ['listen-address', addr])
+ self.cli_set(base_path + ['port', port])
# commit changes
- self.session.commit()
+ self.cli_commit()
for idx in range(0, len(address)):
config = read_file(f'/etc/default/tftpd{idx}')
diff --git a/smoketest/scripts/cli/test_service_webproxy.py b/smoketest/scripts/cli/test_service_webproxy.py
index 3db2daa8f..d47bd452d 100755
--- a/smoketest/scripts/cli/test_service_webproxy.py
+++ b/smoketest/scripts/cli/test_service_webproxy.py
@@ -14,9 +14,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
from vyos.util import cmd
@@ -29,23 +30,21 @@ base_path = ['service', 'webproxy']
listen_if = 'dum3632'
listen_ip = '192.0.2.1'
-class TestServiceWebProxy(unittest.TestCase):
+class TestServiceWebProxy(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
- self.session.set(['interfaces', 'dummy', listen_if, 'address', listen_ip + '/32'])
+ self.cli_set(['interfaces', 'dummy', listen_if, 'address', listen_ip + '/32'])
def tearDown(self):
- self.session.delete(['interfaces', 'dummy', listen_if])
- self.session.delete(base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(['interfaces', 'dummy', listen_if])
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_01_basic_proxy(self):
default_cache = '100'
- self.session.set(base_path + ['listen-address', listen_ip])
+ self.cli_set(base_path + ['listen-address', listen_ip])
# commit changes
- self.session.commit()
+ self.cli_commit()
config = read_file(PROXY_CONF)
self.assertIn(f'http_port {listen_ip}:3128 intercept', config)
@@ -84,24 +83,24 @@ class TestServiceWebProxy(unittest.TestCase):
block_mine = ['application/pdf', 'application/x-sh']
body_max_size = '4096'
- self.session.set(base_path + ['listen-address', listen_ip])
- self.session.set(base_path + ['append-domain', domain])
- self.session.set(base_path + ['default-port', port])
- self.session.set(base_path + ['cache-size', cache_size])
- self.session.set(base_path + ['disable-access-log'])
+ self.cli_set(base_path + ['listen-address', listen_ip])
+ self.cli_set(base_path + ['append-domain', domain])
+ self.cli_set(base_path + ['default-port', port])
+ self.cli_set(base_path + ['cache-size', cache_size])
+ self.cli_set(base_path + ['disable-access-log'])
- self.session.set(base_path + ['minimum-object-size', min_obj_size])
- self.session.set(base_path + ['maximum-object-size', max_obj_size])
+ self.cli_set(base_path + ['minimum-object-size', min_obj_size])
+ self.cli_set(base_path + ['maximum-object-size', max_obj_size])
- self.session.set(base_path + ['outgoing-address', listen_ip])
+ self.cli_set(base_path + ['outgoing-address', listen_ip])
for mime in block_mine:
- self.session.set(base_path + ['reply-block-mime', mime])
+ self.cli_set(base_path + ['reply-block-mime', mime])
- self.session.set(base_path + ['reply-body-max-size', body_max_size])
+ self.cli_set(base_path + ['reply-body-max-size', body_max_size])
# commit changes
- self.session.commit()
+ self.cli_commit()
config = read_file(PROXY_CONF)
self.assertIn(f'http_port {listen_ip}:{port} intercept', config)
@@ -132,34 +131,34 @@ class TestServiceWebProxy(unittest.TestCase):
ldap_attr = 'cn'
ldap_filter = '(cn=%s)'
- self.session.set(base_path + ['listen-address', listen_ip, 'disable-transparent'])
- self.session.set(base_path + ['authentication', 'children', auth_children])
- self.session.set(base_path + ['authentication', 'credentials-ttl', cred_ttl])
+ self.cli_set(base_path + ['listen-address', listen_ip, 'disable-transparent'])
+ self.cli_set(base_path + ['authentication', 'children', auth_children])
+ self.cli_set(base_path + ['authentication', 'credentials-ttl', cred_ttl])
- self.session.set(base_path + ['authentication', 'realm', realm])
- self.session.set(base_path + ['authentication', 'method', 'ldap'])
+ self.cli_set(base_path + ['authentication', 'realm', realm])
+ self.cli_set(base_path + ['authentication', 'method', 'ldap'])
# check validate() - LDAP authentication is enabled, but server not set
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(base_path + ['authentication', 'ldap', 'server', ldap_server])
+ self.cli_commit()
+ self.cli_set(base_path + ['authentication', 'ldap', 'server', ldap_server])
# check validate() - LDAP password can not be set when bind-dn is not define
- self.session.set(base_path + ['authentication', 'ldap', 'password', ldap_password])
+ self.cli_set(base_path + ['authentication', 'ldap', 'password', ldap_password])
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(base_path + ['authentication', 'ldap', 'bind-dn', ldap_bind_dn])
+ self.cli_commit()
+ self.cli_set(base_path + ['authentication', 'ldap', 'bind-dn', ldap_bind_dn])
# check validate() - LDAP base-dn must be set
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.set(base_path + ['authentication', 'ldap', 'base-dn', ldap_base_dn])
+ self.cli_commit()
+ self.cli_set(base_path + ['authentication', 'ldap', 'base-dn', ldap_base_dn])
- self.session.set(base_path + ['authentication', 'ldap', 'username-attribute', ldap_attr])
- self.session.set(base_path + ['authentication', 'ldap', 'filter-expression', ldap_filter])
- self.session.set(base_path + ['authentication', 'ldap', 'use-ssl'])
+ self.cli_set(base_path + ['authentication', 'ldap', 'username-attribute', ldap_attr])
+ self.cli_set(base_path + ['authentication', 'ldap', 'filter-expression', ldap_filter])
+ self.cli_set(base_path + ['authentication', 'ldap', 'use-ssl'])
# commit changes
- self.session.commit()
+ self.cli_commit()
config = read_file(PROXY_CONF)
self.assertIn(f'http_port {listen_ip}:3128', config) # disable-transparent
@@ -175,7 +174,7 @@ class TestServiceWebProxy(unittest.TestCase):
self.assertTrue(process_named_running(PROCESS_NAME))
def test_04_cache_peer(self):
- self.session.set(base_path + ['listen-address', listen_ip])
+ self.cli_set(base_path + ['listen-address', listen_ip])
cache_peers = {
'foo' : '192.0.2.1',
@@ -183,12 +182,12 @@ class TestServiceWebProxy(unittest.TestCase):
'baz' : '192.0.2.3',
}
for peer in cache_peers:
- self.session.set(base_path + ['cache-peer', peer, 'address', cache_peers[peer]])
+ self.cli_set(base_path + ['cache-peer', peer, 'address', cache_peers[peer]])
if peer == 'baz':
- self.session.set(base_path + ['cache-peer', peer, 'type', 'sibling'])
+ self.cli_set(base_path + ['cache-peer', peer, 'type', 'sibling'])
# commit changes
- self.session.commit()
+ self.cli_commit()
config = read_file(PROXY_CONF)
self.assertIn('never_direct allow all', config)
@@ -214,22 +213,22 @@ class TestServiceWebProxy(unittest.TestCase):
local_ok = ['10.0.0.0', 'vyos.net']
local_ok_url = ['vyos.net', 'vyos.io']
- self.session.set(base_path + ['listen-address', listen_ip])
- self.session.set(base_path + ['url-filtering', 'squidguard', 'log', 'all'])
+ self.cli_set(base_path + ['listen-address', listen_ip])
+ self.cli_set(base_path + ['url-filtering', 'squidguard', 'log', 'all'])
for block in local_block:
- self.session.set(base_path + ['url-filtering', 'squidguard', 'local-block', block])
+ self.cli_set(base_path + ['url-filtering', 'squidguard', 'local-block', block])
for ok in local_ok:
- self.session.set(base_path + ['url-filtering', 'squidguard', 'local-ok', ok])
+ self.cli_set(base_path + ['url-filtering', 'squidguard', 'local-ok', ok])
for url in local_block_url:
- self.session.set(base_path + ['url-filtering', 'squidguard', 'local-block-url', url])
+ self.cli_set(base_path + ['url-filtering', 'squidguard', 'local-block-url', url])
for url in local_ok_url:
- self.session.set(base_path + ['url-filtering', 'squidguard', 'local-ok-url', url])
+ self.cli_set(base_path + ['url-filtering', 'squidguard', 'local-ok-url', url])
for pattern in local_block_pattern:
- self.session.set(base_path + ['url-filtering', 'squidguard', 'local-block-keyword', pattern])
+ self.cli_set(base_path + ['url-filtering', 'squidguard', 'local-block-keyword', pattern])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Check regular Squid config
config = read_file(PROXY_CONF)
diff --git a/smoketest/scripts/cli/test_system_acceleration_qat.py b/smoketest/scripts/cli/test_system_acceleration_qat.py
index cadb263f5..9584888d6 100755
--- a/smoketest/scripts/cli/test_system_acceleration_qat.py
+++ b/smoketest/scripts/cli/test_system_acceleration_qat.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2020 Francois Mertz fireboxled@gmail.com
+# Copyright (C) 2020-2021 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -14,34 +14,31 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
base_path = ['system', 'acceleration', 'qat']
-class TestSystemLCD(unittest.TestCase):
- def setUp(self):
- self.session = ConfigSession(os.getpid())
-
+class TestIntelQAT(VyOSUnitTestSHIM.TestCase):
def tearDown(self):
- self.session.delete(base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(base_path)
+ self.cli_commit()
- def test_basic(self):
- """ Check if configuration script is in place and that the config
- script throws an error as QAT device is not present in Qemu. This *must*
- be extended with QAT autodetection once run on a QAT enabled device """
+ def test_simple_unsupported(self):
+ # Check if configuration script is in place and that the config script
+ # throws an error as QAT device is not present in Qemu. This *must* be
+ # extended with QAT autodetection once run on a QAT enabled device
# configure some system display
- self.session.set(base_path)
+ self.cli_set(base_path)
# An error must be thrown if QAT device could not be found
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
if __name__ == '__main__':
unittest.main(verbosity=2)
diff --git a/smoketest/scripts/cli/test_system_ip.py b/smoketest/scripts/cli/test_system_ip.py
index 4ad8d537d..e98a4e234 100755
--- a/smoketest/scripts/cli/test_system_ip.py
+++ b/smoketest/scripts/cli/test_system_ip.py
@@ -14,22 +14,18 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
from vyos.configsession import ConfigSession
from vyos.util import read_file
base_path = ['system', 'ip']
-class TestSystemIP(unittest.TestCase):
- def setUp(self):
- self.session = ConfigSession(os.getpid())
-
+class TestSystemIP(VyOSUnitTestSHIM.TestCase):
def tearDown(self):
- self.session.delete(base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_system_ip_forwarding(self):
# Test if IPv4 forwarding can be disabled globally, default is '1'
@@ -37,8 +33,8 @@ class TestSystemIP(unittest.TestCase):
all_forwarding = '/proc/sys/net/ipv4/conf/all/forwarding'
self.assertEqual(read_file(all_forwarding), '1')
- self.session.set(base_path + ['disable-forwarding'])
- self.session.commit()
+ self.cli_set(base_path + ['disable-forwarding'])
+ self.cli_commit()
self.assertEqual(read_file(all_forwarding), '0')
@@ -50,9 +46,9 @@ class TestSystemIP(unittest.TestCase):
self.assertEqual(read_file(use_neigh), '0')
self.assertEqual(read_file(hash_policy), '0')
- self.session.set(base_path + ['multipath', 'ignore-unreachable-nexthops'])
- self.session.set(base_path + ['multipath', 'layer4-hashing'])
- self.session.commit()
+ self.cli_set(base_path + ['multipath', 'ignore-unreachable-nexthops'])
+ self.cli_set(base_path + ['multipath', 'layer4-hashing'])
+ self.cli_commit()
self.assertEqual(read_file(use_neigh), '1')
self.assertEqual(read_file(hash_policy), '1')
@@ -69,8 +65,8 @@ class TestSystemIP(unittest.TestCase):
self.assertEqual(read_file(gc_thresh1), '1024')
for size in [1024, 2048, 4096, 8192, 16384, 32768]:
- self.session.set(base_path + ['arp', 'table-size', str(size)])
- self.session.commit()
+ self.cli_set(base_path + ['arp', 'table-size', str(size)])
+ self.cli_commit()
self.assertEqual(read_file(gc_thresh3), str(size))
self.assertEqual(read_file(gc_thresh2), str(size // 2))
diff --git a/smoketest/scripts/cli/test_system_ipv6.py b/smoketest/scripts/cli/test_system_ipv6.py
index df69739eb..c9c9e833d 100755
--- a/smoketest/scripts/cli/test_system_ipv6.py
+++ b/smoketest/scripts/cli/test_system_ipv6.py
@@ -14,9 +14,9 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
from vyos.configsession import ConfigSession
from vyos.util import read_file
@@ -27,30 +27,26 @@ file_disable = '/etc/modprobe.d/vyos_disable_ipv6.conf'
file_dad = '/proc/sys/net/ipv6/conf/all/accept_dad'
file_multipath = '/proc/sys/net/ipv6/fib_multipath_hash_policy'
-class TestSystemIPv6(unittest.TestCase):
- def setUp(self):
- self.session = ConfigSession(os.getpid())
-
+class TestSystemIPv6(VyOSUnitTestSHIM.TestCase):
def tearDown(self):
- self.session.delete(base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_system_ipv6_forwarding(self):
# Test if IPv6 forwarding can be disabled globally, default is '1'
# which means forwearding enabled
self.assertEqual(read_file(file_forwarding), '1')
- self.session.set(base_path + ['disable-forwarding'])
- self.session.commit()
+ self.cli_set(base_path + ['disable-forwarding'])
+ self.cli_commit()
self.assertEqual(read_file(file_forwarding), '0')
def test_system_ipv6_disable(self):
# Do not assign any IPv6 address on interfaces, this requires a reboot
# which can not be tested, but we can read the config file :)
- self.session.set(base_path + ['disable'])
- self.session.commit()
+ self.cli_set(base_path + ['disable'])
+ self.cli_commit()
# Verify configuration file
self.assertEqual(read_file(file_disable), 'options ipv6 disable_ipv6=1')
@@ -61,8 +57,8 @@ class TestSystemIPv6(unittest.TestCase):
# Do not assign any IPv6 address on interfaces, this requires a reboot
# which can not be tested, but we can read the config file :)
- self.session.set(base_path + ['strict-dad'])
- self.session.commit()
+ self.cli_set(base_path + ['strict-dad'])
+ self.cli_commit()
# Verify configuration file
self.assertEqual(read_file(file_dad), '2')
@@ -73,8 +69,8 @@ class TestSystemIPv6(unittest.TestCase):
# Do not assign any IPv6 address on interfaces, this requires a reboot
# which can not be tested, but we can read the config file :)
- self.session.set(base_path + ['multipath', 'layer4-hashing'])
- self.session.commit()
+ self.cli_set(base_path + ['multipath', 'layer4-hashing'])
+ self.cli_commit()
# Verify configuration file
self.assertEqual(read_file(file_multipath), '1')
@@ -91,8 +87,8 @@ class TestSystemIPv6(unittest.TestCase):
self.assertEqual(read_file(gc_thresh1), '1024')
for size in [1024, 2048, 4096, 8192, 16384, 32768]:
- self.session.set(base_path + ['neighbor', 'table-size', str(size)])
- self.session.commit()
+ self.cli_set(base_path + ['neighbor', 'table-size', str(size)])
+ self.cli_commit()
self.assertEqual(read_file(gc_thresh3), str(size))
self.assertEqual(read_file(gc_thresh2), str(size // 2))
diff --git a/smoketest/scripts/cli/test_system_lcd.py b/smoketest/scripts/cli/test_system_lcd.py
index 2bf601e3b..7a39e2986 100755
--- a/smoketest/scripts/cli/test_system_lcd.py
+++ b/smoketest/scripts/cli/test_system_lcd.py
@@ -14,32 +14,29 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
from configparser import ConfigParser
+
from vyos.configsession import ConfigSession
from vyos.util import process_named_running
config_file = '/run/LCDd/LCDd.conf'
base_path = ['system', 'lcd']
-class TestSystemLCD(unittest.TestCase):
- def setUp(self):
- self.session = ConfigSession(os.getpid())
-
+class TestSystemLCD(VyOSUnitTestSHIM.TestCase):
def tearDown(self):
- self.session.delete(base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_system_display(self):
# configure some system display
- self.session.set(base_path + ['device', 'ttyS1'])
- self.session.set(base_path + ['model', 'cfa-533'])
+ self.cli_set(base_path + ['device', 'ttyS1'])
+ self.cli_set(base_path + ['model', 'cfa-533'])
# commit changes
- self.session.commit()
+ self.cli_commit()
# load up ini-styled LCDd.conf
conf = ConfigParser()
diff --git a/smoketest/scripts/cli/test_system_login.py b/smoketest/scripts/cli/test_system_login.py
index bb6f57fc2..aa97511e0 100755
--- a/smoketest/scripts/cli/test_system_login.py
+++ b/smoketest/scripts/cli/test_system_login.py
@@ -14,11 +14,12 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import re
import platform
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from distutils.version import LooseVersion
from platform import release as kernel_version
from subprocess import Popen, PIPE
@@ -32,31 +33,27 @@ from vyos.template import inc_ip
base_path = ['system', 'login']
users = ['vyos1', 'vyos2']
-class TestSystemLogin(unittest.TestCase):
- def setUp(self):
- self.session = ConfigSession(os.getpid())
-
+class TestSystemLogin(VyOSUnitTestSHIM.TestCase):
def tearDown(self):
# Delete individual users from configuration
for user in users:
- self.session.delete(base_path + ['user', user])
+ self.cli_delete(base_path + ['user', user])
- self.session.commit()
- del self.session
+ self.cli_commit()
def test_system_login_user(self):
# Check if user can be created and we can SSH to localhost
- self.session.set(['service', 'ssh', 'port', '22'])
+ self.cli_set(['service', 'ssh', 'port', '22'])
for user in users:
name = "VyOS Roxx " + user
home_dir = "/tmp/" + user
- self.session.set(base_path + ['user', user, 'authentication', 'plaintext-password', user])
- self.session.set(base_path + ['user', user, 'full-name', 'VyOS Roxx'])
- self.session.set(base_path + ['user', user, 'home-directory', home_dir])
+ self.cli_set(base_path + ['user', user, 'authentication', 'plaintext-password', user])
+ self.cli_set(base_path + ['user', user, 'full-name', 'VyOS Roxx'])
+ self.cli_set(base_path + ['user', user, 'home-directory', home_dir])
- self.session.commit()
+ self.cli_commit()
for user in users:
cmd = ['su','-', user]
@@ -93,18 +90,18 @@ class TestSystemLogin(unittest.TestCase):
radius_port = '2000'
radius_timeout = '1'
- self.session.set(base_path + ['radius', 'server', radius_server, 'key', radius_key])
- self.session.set(base_path + ['radius', 'server', radius_server, 'port', radius_port])
- self.session.set(base_path + ['radius', 'server', radius_server, 'timeout', radius_timeout])
- self.session.set(base_path + ['radius', 'source-address', radius_source])
- self.session.set(base_path + ['radius', 'source-address', inc_ip(radius_source, 1)])
+ self.cli_set(base_path + ['radius', 'server', radius_server, 'key', radius_key])
+ self.cli_set(base_path + ['radius', 'server', radius_server, 'port', radius_port])
+ self.cli_set(base_path + ['radius', 'server', radius_server, 'timeout', radius_timeout])
+ self.cli_set(base_path + ['radius', 'source-address', radius_source])
+ self.cli_set(base_path + ['radius', 'source-address', inc_ip(radius_source, 1)])
# check validate() - Only one IPv4 source-address supported
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(base_path + ['radius', 'source-address', inc_ip(radius_source, 1)])
+ self.cli_commit()
+ self.cli_delete(base_path + ['radius', 'source-address', inc_ip(radius_source, 1)])
- self.session.commit()
+ self.cli_commit()
# this file must be read with higher permissions
pam_radius_auth_conf = cmd('sudo cat /etc/pam_radius_auth.conf')
@@ -147,18 +144,18 @@ class TestSystemLogin(unittest.TestCase):
radius_port = '4000'
radius_timeout = '4'
- self.session.set(base_path + ['radius', 'server', radius_server, 'key', radius_key])
- self.session.set(base_path + ['radius', 'server', radius_server, 'port', radius_port])
- self.session.set(base_path + ['radius', 'server', radius_server, 'timeout', radius_timeout])
- self.session.set(base_path + ['radius', 'source-address', radius_source])
- self.session.set(base_path + ['radius', 'source-address', inc_ip(radius_source, 1)])
+ self.cli_set(base_path + ['radius', 'server', radius_server, 'key', radius_key])
+ self.cli_set(base_path + ['radius', 'server', radius_server, 'port', radius_port])
+ self.cli_set(base_path + ['radius', 'server', radius_server, 'timeout', radius_timeout])
+ self.cli_set(base_path + ['radius', 'source-address', radius_source])
+ self.cli_set(base_path + ['radius', 'source-address', inc_ip(radius_source, 1)])
# check validate() - Only one IPv4 source-address supported
with self.assertRaises(ConfigSessionError):
- self.session.commit()
- self.session.delete(base_path + ['radius', 'source-address', inc_ip(radius_source, 1)])
+ self.cli_commit()
+ self.cli_delete(base_path + ['radius', 'source-address', inc_ip(radius_source, 1)])
- self.session.commit()
+ self.cli_commit()
# this file must be read with higher permissions
pam_radius_auth_conf = cmd('sudo cat /etc/pam_radius_auth.conf')
diff --git a/smoketest/scripts/cli/test_system_nameserver.py b/smoketest/scripts/cli/test_system_nameserver.py
index 5610c90c7..50dc466c2 100755
--- a/smoketest/scripts/cli/test_system_nameserver.py
+++ b/smoketest/scripts/cli/test_system_nameserver.py
@@ -14,12 +14,15 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import re
import unittest
-from vyos.configsession import ConfigSession, ConfigSessionError
-import vyos.util as util
+from base_vyostest_shim import VyOSUnitTestSHIM
+
+from vyos.configsession import ConfigSession
+from vyos.configsession import ConfigSessionError
+
+from vyos.util import read_file
RESOLV_CONF = '/etc/resolv.conf'
@@ -27,25 +30,20 @@ test_servers = ['192.0.2.10', '2001:db8:1::100']
base_path = ['system', 'name-server']
def get_name_servers():
- resolv_conf = util.read_file(RESOLV_CONF)
+ resolv_conf = read_file(RESOLV_CONF)
return re.findall(r'\n?nameserver\s+(.*)', resolv_conf)
-class TestSystemNameServer(unittest.TestCase):
- def setUp(self):
- self.session = ConfigSession(os.getpid())
-
+class TestSystemNameServer(VyOSUnitTestSHIM.TestCase):
def tearDown(self):
# Delete existing name servers
- self.session.delete(base_path)
- self.session.commit()
-
- del self.session
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_nameserver_add(self):
# Check if server is added to resolv.conf
for s in test_servers:
- self.session.set(base_path + [s])
- self.session.commit()
+ self.cli_set(base_path + [s])
+ self.cli_commit()
servers = get_name_servers()
for s in servers:
@@ -54,8 +52,8 @@ class TestSystemNameServer(unittest.TestCase):
def test_nameserver_delete(self):
# Test if a deleted server disappears from resolv.conf
for s in test_servers:
- self.session.delete(base_path + [s])
- self.session.commit()
+ self.cli_delete(base_path + [s])
+ self.cli_commit()
servers = get_name_servers()
for s in servers:
diff --git a/smoketest/scripts/cli/test_system_ntp.py b/smoketest/scripts/cli/test_system_ntp.py
index edb6ad94d..2b86ebd7c 100755
--- a/smoketest/scripts/cli/test_system_ntp.py
+++ b/smoketest/scripts/cli/test_system_ntp.py
@@ -15,9 +15,10 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import re
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
from vyos.template import address_from_cidr
@@ -35,17 +36,15 @@ def get_config_value(key):
# remove possible trailing whitespaces
return [item.strip() for item in tmp]
-class TestSystemNTP(unittest.TestCase):
+class TestSystemNTP(VyOSUnitTestSHIM.TestCase):
def setUp(self):
- self.session = ConfigSession(os.getpid())
# ensure we can also run this test on a live system - so lets clean
# out the current configuration :)
- self.session.delete(base_path)
+ self.cli_delete(base_path)
def tearDown(self):
- self.session.delete(base_path)
- self.session.commit()
- del self.session
+ self.cli_delete(base_path)
+ self.cli_commit()
self.assertFalse(process_named_running(PROCESS_NAME))
@@ -57,13 +56,13 @@ class TestSystemNTP(unittest.TestCase):
for server in servers:
for option in options:
- self.session.set(base_path + ['server', server, option])
+ self.cli_set(base_path + ['server', server, option])
# Test NTP pool
- self.session.set(base_path + ['server', ntp_pool, 'pool'])
+ self.cli_set(base_path + ['server', ntp_pool, 'pool'])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Check generated configuration
tmp = get_config_value('server')
@@ -81,21 +80,21 @@ class TestSystemNTP(unittest.TestCase):
# Test the allowed-networks statement
listen_address = ['127.0.0.1', '::1']
for listen in listen_address:
- self.session.set(base_path + ['listen-address', listen])
+ self.cli_set(base_path + ['listen-address', listen])
networks = ['192.0.2.0/24', '2001:db8:1000::/64']
for network in networks:
- self.session.set(base_path + ['allow-clients', 'address', network])
+ self.cli_set(base_path + ['allow-clients', 'address', network])
# Verify "NTP server not configured" verify() statement
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
servers = ['192.0.2.1', '192.0.2.2']
for server in servers:
- self.session.set(base_path + ['server', server])
+ self.cli_set(base_path + ['server', server])
- self.session.commit()
+ self.cli_commit()
# Check generated client address configuration
for network in networks:
diff --git a/smoketest/scripts/cli/test_vpn_openconnect.py b/smoketest/scripts/cli/test_vpn_openconnect.py
index e27216e09..bf528c8b7 100755
--- a/smoketest/scripts/cli/test_vpn_openconnect.py
+++ b/smoketest/scripts/cli/test_vpn_openconnect.py
@@ -14,9 +14,10 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
-import os
import unittest
+from base_vyostest_shim import VyOSUnitTestSHIM
+
from vyos.configsession import ConfigSession
from vyos.util import process_named_running
@@ -25,29 +26,24 @@ base_path = ['vpn', 'openconnect']
cert = '/etc/ssl/certs/ssl-cert-snakeoil.pem'
cert_key = '/etc/ssl/private/ssl-cert-snakeoil.key'
-class TestVpnOpenconnect(unittest.TestCase):
- def setUp(self):
- self.session = ConfigSession(os.getpid())
-
+class TestVpnOpenconnect(VyOSUnitTestSHIM.TestCase):
def tearDown(self):
# Delete vpn openconnect configuration
- self.session.delete(base_path)
- self.session.commit()
-
- del self.session
+ self.cli_delete(base_path)
+ self.cli_commit()
def test_vpn(self):
user = 'vyos_user'
password = 'vyos_pass'
- self.session.delete(base_path)
- self.session.set(base_path + ["authentication", "local-users", "username", user, "password", password])
- self.session.set(base_path + ["authentication", "mode", "local"])
- self.session.set(base_path + ["network-settings", "client-ip-settings", "subnet", "192.0.2.0/24"])
- self.session.set(base_path + ["ssl", "ca-cert-file", cert])
- self.session.set(base_path + ["ssl", "cert-file", cert])
- self.session.set(base_path + ["ssl", "key-file", cert_key])
-
- self.session.commit()
+ self.cli_delete(base_path)
+ self.cli_set(base_path + ["authentication", "local-users", "username", user, "password", password])
+ self.cli_set(base_path + ["authentication", "mode", "local"])
+ self.cli_set(base_path + ["network-settings", "client-ip-settings", "subnet", "192.0.2.0/24"])
+ self.cli_set(base_path + ["ssl", "ca-cert-file", cert])
+ self.cli_set(base_path + ["ssl", "cert-file", cert])
+ self.cli_set(base_path + ["ssl", "key-file", cert_key])
+
+ self.cli_commit()
# Check for running process
self.assertTrue(process_named_running('ocserv-main'))
diff --git a/smoketest/scripts/cli/test_vpn_sstp.py b/smoketest/scripts/cli/test_vpn_sstp.py
index 95fe38dd9..033338685 100755
--- a/smoketest/scripts/cli/test_vpn_sstp.py
+++ b/smoketest/scripts/cli/test_vpn_sstp.py
@@ -23,18 +23,14 @@ ca_cert = '/tmp/ca.crt'
ssl_cert = '/tmp/server.crt'
ssl_key = '/tmp/server.key'
-class TestVPNSSTPServer(BasicAccelPPPTest.BaseTest):
+class TestVPNSSTPServer(BasicAccelPPPTest.TestCase):
def setUp(self):
self._base_path = ['vpn', 'sstp']
self._process_name = 'accel-pppd'
self._config_file = '/run/accel-pppd/sstp.conf'
self._chap_secrets = '/run/accel-pppd/sstp.chap-secrets'
-
super().setUp()
- def tearDown(self):
- super().tearDown()
-
def basic_config(self):
# SSL is mandatory
self.set(['ssl', 'ca-cert-file', ca_cert])
diff --git a/smoketest/scripts/cli/test_vrf.py b/smoketest/scripts/cli/test_vrf.py
index 8e977d407..591630c46 100755
--- a/smoketest/scripts/cli/test_vrf.py
+++ b/smoketest/scripts/cli/test_vrf.py
@@ -20,6 +20,7 @@ import json
import unittest
from netifaces import interfaces
+from base_vyostest_shim import VyOSUnitTestSHIM
from vyos.configsession import ConfigSession
from vyos.configsession import ConfigSessionError
@@ -33,13 +34,7 @@ from vyos.validate import is_intf_addr_assigned
base_path = ['vrf']
vrfs = ['red', 'green', 'blue', 'foo-bar', 'baz_foo']
-def get_vrf_ipv4_routes(vrf):
- return json.loads(cmd(f'ip -4 -j route show vrf {vrf}'))
-
-def get_vrf_ipv6_routes(vrf):
- return json.loads(cmd(f'ip -6 -j route show vrf {vrf}'))
-
-class VRFTest(unittest.TestCase):
+class VRFTest(VyOSUnitTestSHIM.TestCase):
_interfaces = []
@classmethod
@@ -53,14 +48,13 @@ class VRFTest(unittest.TestCase):
for tmp in Section.interfaces('ethernet'):
if not '.' in tmp:
cls._interfaces.append(tmp)
-
- def setUp(self):
- self.session = ConfigSession(os.getpid())
+ # call base-classes classmethod
+ super(cls, cls).setUpClass()
def tearDown(self):
# delete all VRFs
- self.session.delete(base_path)
- self.session.commit()
+ self.cli_delete(base_path)
+ self.cli_commit()
for vrf in vrfs:
self.assertNotIn(vrf, interfaces())
@@ -69,20 +63,20 @@ class VRFTest(unittest.TestCase):
for vrf in vrfs:
base = base_path + ['name', vrf]
description = f'VyOS-VRF-{vrf}'
- self.session.set(base + ['description', description])
+ self.cli_set(base + ['description', description])
# check validate() - a table ID is mandatory
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
- self.session.set(base + ['table', table])
+ self.cli_set(base + ['table', table])
if vrf == 'green':
- self.session.set(base + ['disable'])
+ self.cli_set(base + ['disable'])
table = str(int(table) + 1)
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify VRF configuration
table = '1000'
@@ -113,11 +107,11 @@ class VRFTest(unittest.TestCase):
table = '2000'
for vrf in vrfs:
base = base_path + ['name', vrf]
- self.session.set(base + ['table', str(table)])
+ self.cli_set(base + ['table', str(table)])
table = str(int(table) + 1)
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify VRF configuration
for vrf in vrfs:
@@ -131,31 +125,31 @@ class VRFTest(unittest.TestCase):
table = '1000'
vrf = vrfs[0]
base = base_path + ['name', vrf]
- self.session.set(base + ['table', table])
+ self.cli_set(base + ['table', table])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Check if VRF has been created
self.assertTrue(vrf in interfaces())
table = str(int(table) + 1)
- self.session.set(base + ['table', table])
+ self.cli_set(base + ['table', table])
# check validate() - table ID can not be altered!
with self.assertRaises(ConfigSessionError):
- self.session.commit()
+ self.cli_commit()
def test_vrf_assign_interface(self):
vrf = vrfs[0]
table = '5000'
- self.session.set(['vrf', 'name', vrf, 'table', table])
+ self.cli_set(['vrf', 'name', vrf, 'table', table])
for interface in self._interfaces:
section = Section.section(interface)
- self.session.set(['interfaces', section, interface, 'vrf', vrf])
+ self.cli_set(['interfaces', section, interface, 'vrf', vrf])
# commit changes
- self.session.commit()
+ self.cli_commit()
# Verify & cleanup
for interface in self._interfaces:
@@ -164,7 +158,7 @@ class VRFTest(unittest.TestCase):
self.assertEqual(tmp, vrf)
# cleanup
section = Section.section(interface)
- self.session.delete(['interfaces', section, interface, 'vrf'])
+ self.cli_delete(['interfaces', section, interface, 'vrf'])
if __name__ == '__main__':
unittest.main(verbosity=2)
diff --git a/smoketest/scripts/system/test_iproute2.py b/smoketest/scripts/system/test_iproute2.py
new file mode 100755
index 000000000..2d2fe195b
--- /dev/null
+++ b/smoketest/scripts/system/test_iproute2.py
@@ -0,0 +1,31 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2021 VyOS maintainers and contributors
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or later as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+import unittest
+
+class TestIproute2(unittest.TestCase):
+ def test_ip_is_symlink(self):
+ # For an unknown reason VyOS 1.3.0-rc2 did not have a symlink from
+ # /usr/sbin/ip -> /bin/ip - verify this now and forever
+ real_file = '/bin/ip'
+ symlink = '/usr/sbin/ip'
+ self.assertTrue(os.path.islink(symlink))
+ self.assertFalse(os.path.islink(real_file))
+ self.assertEqual(os.readlink(symlink), real_file)
+
+if __name__ == '__main__':
+ unittest.main(verbosity=2)
diff --git a/src/completion/list_bgp_peer_groups.sh b/src/completion/list_bgp_peer_groups.sh
new file mode 100755
index 000000000..4503d608f
--- /dev/null
+++ b/src/completion/list_bgp_peer_groups.sh
@@ -0,0 +1,23 @@
+#!/bin/sh
+# Copyright (C) 2021 VyOS maintainers and contributors
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or later as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# Return BGP peer-groups from CLI
+
+declare -a vals
+eval "bgp_as=$(cli-shell-api listNodes protocols bgp)"
+eval "vals=($(cli-shell-api listNodes protocols bgp $bgp_as peer-group))"
+
+echo -n ${vals[@]}
+exit 0
diff --git a/src/conf_mode/dynamic_dns.py b/src/conf_mode/dynamic_dns.py
index 6d39c6644..c979feca7 100755
--- a/src/conf_mode/dynamic_dns.py
+++ b/src/conf_mode/dynamic_dns.py
@@ -114,7 +114,7 @@ def verify(dyndns):
raise ConfigError(f'"password" {error_msg}')
if 'zone' in config:
- if service != 'cloudflare':
+ if service != 'cloudflare' and ('protocol' not in config or config['protocol'] != 'cloudflare'):
raise ConfigError(f'"zone" option only supported with CloudFlare')
if 'custom' in config:
diff --git a/src/conf_mode/http-api.py b/src/conf_mode/http-api.py
index 472eb77e4..7e4b117c8 100755
--- a/src/conf_mode/http-api.py
+++ b/src/conf_mode/http-api.py
@@ -19,6 +19,7 @@
import sys
import os
import json
+import time
from copy import deepcopy
import vyos.defaults
@@ -34,11 +35,6 @@ config_file = '/etc/vyos/http-api.conf'
vyos_conf_scripts_dir=vyos.defaults.directories['conf_mode']
-# XXX: this model will need to be extended for tag nodes
-dependencies = [
- 'https.py',
-]
-
def get_config(config=None):
http_api = deepcopy(vyos.defaults.api_data)
x = http_api.get('api_keys')
@@ -103,8 +99,10 @@ def apply(http_api):
else:
call('systemctl stop vyos-http-api.service')
- for dep in dependencies:
- cmd(f'{vyos_conf_scripts_dir}/{dep}', raising=ConfigError)
+ # Let uvicorn settle before restarting Nginx
+ time.sleep(2)
+
+ cmd(f'{vyos_conf_scripts_dir}/https.py', raising=ConfigError)
if __name__ == '__main__':
try:
diff --git a/src/conf_mode/interfaces-tunnel.py b/src/conf_mode/interfaces-tunnel.py
index b63312750..cab94a5b0 100755
--- a/src/conf_mode/interfaces-tunnel.py
+++ b/src/conf_mode/interfaces-tunnel.py
@@ -34,7 +34,7 @@ from vyos.ifconfig import Interface
from vyos.ifconfig import TunnelIf
from vyos.template import is_ipv4
from vyos.template import is_ipv6
-from vyos.util import get_json_iface_options
+from vyos.util import get_interface_config
from vyos.util import dict_search
from vyos import ConfigError
from vyos import airbag
@@ -103,7 +103,7 @@ def apply(tunnel):
# There is no other solution to destroy and recreate the tunnel.
encap = ''
remote = ''
- tmp = get_json_iface_options(interface)
+ tmp = get_interface_config(interface)
if tmp:
encap = dict_search('linkinfo.info_kind', tmp)
remote = dict_search('linkinfo.info_data.remote', tmp)
diff --git a/src/conf_mode/nat66.py b/src/conf_mode/nat66.py
index ce1db316c..e2bd6417d 100755
--- a/src/conf_mode/nat66.py
+++ b/src/conf_mode/nat66.py
@@ -28,7 +28,6 @@ from vyos.util import cmd
from vyos.util import check_kmod
from vyos.util import dict_search
from vyos.template import is_ipv6
-from vyos.template import is_ip_network
from vyos.xml import defaults
from vyos import ConfigError
from vyos import airbag
@@ -80,8 +79,10 @@ def get_config(config=None):
if not conf.exists(base):
nat['helper_functions'] = 'remove'
+ nat['pre_ct_ignore'] = get_handler(condensed_json, 'PREROUTING', 'VYATTA_CT_HELPER')
nat['pre_ct_conntrack'] = get_handler(condensed_json, 'PREROUTING', 'NAT_CONNTRACK')
- nat['out_ct_conntrack'] = get_handler(condensed_json, 'OUTPUT','NAT_CONNTRACK')
+ nat['out_ct_ignore'] = get_handler(condensed_json, 'OUTPUT', 'VYATTA_CT_HELPER')
+ nat['out_ct_conntrack'] = get_handler(condensed_json, 'OUTPUT', 'NAT_CONNTRACK')
nat['deleted'] = ''
return nat
@@ -91,8 +92,10 @@ def get_config(config=None):
nat['helper_functions'] = 'add'
# Retrieve current table handler positions
+ nat['pre_ct_ignore'] = get_handler(condensed_json, 'PREROUTING', 'VYATTA_CT_IGNORE')
nat['pre_ct_conntrack'] = get_handler(condensed_json, 'PREROUTING', 'VYATTA_CT_PREROUTING_HOOK')
- nat['out_ct_conntrack'] = get_handler(condensed_json, 'OUTPUT','VYATTA_CT_OUTPUT_HOOK')
+ nat['out_ct_ignore'] = get_handler(condensed_json, 'OUTPUT', 'VYATTA_CT_IGNORE')
+ nat['out_ct_conntrack'] = get_handler(condensed_json, 'OUTPUT', 'VYATTA_CT_OUTPUT_HOOK')
else:
nat['helper_functions'] = 'has'
diff --git a/src/conf_mode/policy-lists.py b/src/conf_mode/policy-lists.py
new file mode 100755
index 000000000..94a020e7b
--- /dev/null
+++ b/src/conf_mode/policy-lists.py
@@ -0,0 +1,117 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2021 VyOS maintainers and contributors
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or later as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import os
+
+from sys import exit
+
+from vyos.config import Config
+from vyos.configdict import dict_merge
+from vyos.template import render
+from vyos.template import render_to_string
+from vyos.util import call
+from vyos.util import dict_search
+from vyos import ConfigError
+from vyos import frr
+from vyos import airbag
+from pprint import pprint
+airbag.enable()
+
+config_file = r'/tmp/policy.frr'
+frr_daemon = 'zebra'
+
+DEBUG = os.path.exists('/tmp/policy.debug')
+if DEBUG:
+ import logging
+ lg = logging.getLogger("vyos.frr")
+ lg.setLevel(logging.DEBUG)
+ ch = logging.StreamHandler()
+ lg.addHandler(ch)
+
+def get_config(config=None):
+ if config:
+ conf = config
+ else:
+ conf = Config()
+ base = ['npolicy']
+ policy = conf.get_config_dict(base, key_mangling=('-', '_'))
+
+ # Bail out early if configuration tree does not exist
+ if not conf.exists(base):
+ return policy
+
+ pprint(policy)
+ exit(1)
+ return policy
+
+def verify(policy):
+ if not policy:
+ return None
+
+ return None
+
+def generate(policy):
+ if not policy:
+ policy['new_frr_config'] = ''
+ return None
+
+ # render(config) not needed, its only for debug
+ # render(config_file, 'frr/policy.frr.tmpl', policy)
+ # policy['new_frr_config'] = render_to_string('frr/policy.frr.tmpl')
+
+ return None
+
+def apply(policy):
+ # Save original configuration prior to starting any commit actions
+ # frr_cfg = frr.FRRConfig()
+ # frr_cfg.load_configuration(frr_daemon)
+ # frr_cfg.modify_section(f'ip', '')
+ # frr_cfg.add_before(r'(line vty)', policy['new_frr_config'])
+
+ # Debugging
+ if DEBUG:
+ from pprint import pprint
+ print('')
+ print('--------- DEBUGGING ----------')
+ pprint(dir(frr_cfg))
+ print('Existing config:\n')
+ for line in frr_cfg.original_config:
+ print(line)
+ print(f'Replacement config:\n')
+ print(f'{policy["new_frr_config"]}')
+ print(f'Modified config:\n')
+ print(f'{frr_cfg}')
+
+ # frr_cfg.commit_configuration(frr_daemon)
+
+ # If FRR config is blank, rerun the blank commit x times due to frr-reload
+ # behavior/bug not properly clearing out on one commit.
+ # if policy['new_frr_config'] == '':
+ # for a in range(5):
+ # frr_cfg.commit_configuration(frr_daemon)
+
+
+ return None
+
+if __name__ == '__main__':
+ try:
+ c = get_config()
+ verify(c)
+ generate(c)
+ apply(c)
+ except ConfigError as e:
+ print(e)
+ exit(1)
diff --git a/src/conf_mode/protocols_bgp.py b/src/conf_mode/protocols_bgp.py
index 7dede74a1..6770865ff 100755
--- a/src/conf_mode/protocols_bgp.py
+++ b/src/conf_mode/protocols_bgp.py
@@ -17,6 +17,7 @@
import os
from sys import exit
+from sys import argv
from vyos.config import Config
from vyos.configdict import dict_merge
@@ -37,32 +38,42 @@ def get_config(config=None):
conf = config
else:
conf = Config()
- base = ['protocols', 'bgp']
+
+ vrf = None
+ if len(argv) > 1:
+ vrf = argv[1]
+
+ base_path = ['protocols', 'bgp']
+
+ # eqivalent of the C foo ? 'a' : 'b' statement
+ base = vrf and ['vrf', 'name', vrf, 'protocols', 'bgp'] or base_path
bgp = conf.get_config_dict(base, key_mangling=('-', '_'), get_first_key=True)
- # Bail out early if configuration tree does not exist
+ # Assign the name of our VRF context. This MUST be done before the return
+ # statement below, else on deletion we will delete the default instance
+ # instead of the VRF instance.
+ if vrf: bgp.update({'vrf' : vrf})
+
if not conf.exists(base):
+ bgp.update({'deleted' : ''})
return bgp
# We also need some additional information from the config,
# prefix-lists and route-maps for instance.
base = ['policy']
tmp = conf.get_config_dict(base, key_mangling=('-', '_'))
- # As we only support one ASN (later checked in begin of verify()) we add the
- # new information only to the first AS number
- asn = next(iter(bgp))
# Merge policy dict into bgp dict
- bgp[asn] = dict_merge(tmp, bgp[asn])
+ bgp = dict_merge(tmp, bgp)
return bgp
-def verify_remote_as(peer_config, asn_config):
+def verify_remote_as(peer_config, bgp_config):
if 'remote_as' in peer_config:
return peer_config['remote_as']
if 'peer_group' in peer_config:
peer_group_name = peer_config['peer_group']
- tmp = dict_search(f'peer_group.{peer_group_name}.remote_as', asn_config)
+ tmp = dict_search(f'peer_group.{peer_group_name}.remote_as', bgp_config)
if tmp: return tmp
if 'interface' in peer_config:
@@ -71,127 +82,128 @@ def verify_remote_as(peer_config, asn_config):
if 'peer_group' in peer_config['interface']:
peer_group_name = peer_config['interface']['peer_group']
- tmp = dict_search(f'peer_group.{peer_group_name}.remote_as', asn_config)
+ tmp = dict_search(f'peer_group.{peer_group_name}.remote_as', bgp_config)
if tmp: return tmp
return None
def verify(bgp):
- if not bgp:
+ if not bgp or 'deleted' in bgp:
return None
- # Check if declared more than one ASN
- if len(bgp) > 1:
- raise ConfigError('Only one BGP AS number can be defined!')
-
- for asn, asn_config in bgp.items():
- # Common verification for both peer-group and neighbor statements
- for neighbor in ['neighbor', 'peer_group']:
- # bail out early if there is no neighbor or peer-group statement
- # this also saves one indention level
- if neighbor not in asn_config:
- continue
-
- for peer, peer_config in asn_config[neighbor].items():
- # Only regular "neighbor" statement can have a peer-group set
- # Check if the configure peer-group exists
- if 'peer_group' in peer_config:
- peer_group = peer_config['peer_group']
- if 'peer_group' not in asn_config or peer_group not in asn_config['peer_group']:
- raise ConfigError(f'Specified peer-group "{peer_group}" for '\
- f'neighbor "{neighbor}" does not exist!')
-
- # ttl-security and ebgp-multihop can't be used in the same configration
- if 'ebgp_multihop' in peer_config and 'ttl_security' in peer_config:
- raise ConfigError('You can\'t set both ebgp-multihop and ttl-security hops')
-
- # Check spaces in the password
- if 'password' in peer_config and ' ' in peer_config['password']:
- raise ConfigError('You can\'t use spaces in the password')
-
- # Some checks can/must only be done on a neighbor and not a peer-group
- if neighbor == 'neighbor':
- # remote-as must be either set explicitly for the neighbor
- # or for the entire peer-group
- if not verify_remote_as(peer_config, asn_config):
- raise ConfigError(f'Neighbor "{peer}" remote-as must be set!')
-
- # Only checks for ipv4 and ipv6 neighbors
- # Check if neighbor address is assigned as system interface address
- if is_ip(peer) and is_addr_assigned(peer):
- raise ConfigError(f'Can\'t configure local address as neighbor "{peer}"')
-
- for afi in ['ipv4_unicast', 'ipv6_unicast', 'l2vpn_evpn']:
- # Bail out early if address family is not configured
- if 'address_family' not in peer_config or afi not in peer_config['address_family']:
- continue
-
- afi_config = peer_config['address_family'][afi]
- # Validate if configured Prefix list exists
- if 'prefix_list' in afi_config:
- for tmp in ['import', 'export']:
- if tmp not in afi_config['prefix_list']:
- # bail out early
- continue
- # get_config_dict() mangles all '-' characters to '_' this is legitimate, thus all our
- # compares will run on '_' as also '_' is a valid name for a prefix-list
- prefix_list = afi_config['prefix_list'][tmp].replace('-', '_')
- if afi == 'ipv4_unicast':
- if dict_search(f'policy.prefix_list.{prefix_list}', asn_config) == None:
- raise ConfigError(f'prefix-list "{prefix_list}" used for "{tmp}" does not exist!')
- elif afi == 'ipv6_unicast':
- if dict_search(f'policy.prefix_list6.{prefix_list}', asn_config) == None:
- raise ConfigError(f'prefix-list6 "{prefix_list}" used for "{tmp}" does not exist!')
-
- if 'route_map' in afi_config:
- for tmp in ['import', 'export']:
- if tmp in afi_config['route_map']:
- # get_config_dict() mangles all '-' characters to '_' this is legitim, thus all our
- # compares will run on '_' as also '_' is a valid name for a route-map
- route_map = afi_config['route_map'][tmp].replace('-', '_')
- if dict_search(f'policy.route_map.{route_map}', asn_config) == None:
- raise ConfigError(f'route-map "{route_map}" used for "{tmp}" does not exist!')
-
- if 'route_reflector_client' in afi_config:
- if 'remote_as' in peer_config and asn != peer_config['remote_as']:
- raise ConfigError('route-reflector-client only supported for iBGP peers')
- else:
- if 'peer_group' in peer_config:
- peer_group_as = dict_search(f'peer_group.{peer_group}.remote_as', asn_config)
- if peer_group_as != None and peer_group_as != asn:
- raise ConfigError('route-reflector-client only supported for iBGP peers')
-
- # Throw an error if a peer group is not configured for allow range
- for prefix in dict_search('listen.range', asn_config) or []:
- # we can not use dict_search() here as prefix contains dots ...
- if 'peer_group' not in asn_config['listen']['range'][prefix]:
- raise ConfigError(f'Listen range for prefix "{prefix}" has no peer group configured.')
- else:
- peer_group = asn_config['listen']['range'][prefix]['peer_group']
- # the peer group must also exist
- if not dict_search(f'peer_group.{peer_group}', asn_config):
- raise ConfigError(f'Peer-group "{peer_group}" for listen range "{prefix}" does not exist!')
+ if 'local_as' not in bgp:
+ raise ConfigError('BGP local-as number must be defined!')
+
+ # Common verification for both peer-group and neighbor statements
+ for neighbor in ['neighbor', 'peer_group']:
+ # bail out early if there is no neighbor or peer-group statement
+ # this also saves one indention level
+ if neighbor not in bgp:
+ continue
+
+ for peer, peer_config in bgp[neighbor].items():
+ # Only regular "neighbor" statement can have a peer-group set
+ # Check if the configure peer-group exists
+ if 'peer_group' in peer_config:
+ peer_group = peer_config['peer_group']
+ if 'peer_group' not in bgp or peer_group not in bgp['peer_group']:
+ raise ConfigError(f'Specified peer-group "{peer_group}" for '\
+ f'neighbor "{neighbor}" does not exist!')
+
+ # ttl-security and ebgp-multihop can't be used in the same configration
+ if 'ebgp_multihop' in peer_config and 'ttl_security' in peer_config:
+ raise ConfigError('You can\'t set both ebgp-multihop and ttl-security hops')
+
+ # Check spaces in the password
+ if 'password' in peer_config and ' ' in peer_config['password']:
+ raise ConfigError('You can\'t use spaces in the password')
+
+ # Some checks can/must only be done on a neighbor and not a peer-group
+ if neighbor == 'neighbor':
+ # remote-as must be either set explicitly for the neighbor
+ # or for the entire peer-group
+ if not verify_remote_as(peer_config, bgp):
+ raise ConfigError(f'Neighbor "{peer}" remote-as must be set!')
+
+ # Only checks for ipv4 and ipv6 neighbors
+ # Check if neighbor address is assigned as system interface address
+ if is_ip(peer) and is_addr_assigned(peer):
+ raise ConfigError(f'Can\'t configure local address as neighbor "{peer}"')
+
+ for afi in ['ipv4_unicast', 'ipv6_unicast', 'l2vpn_evpn']:
+ # Bail out early if address family is not configured
+ if 'address_family' not in peer_config or afi not in peer_config['address_family']:
+ continue
+
+ afi_config = peer_config['address_family'][afi]
+ # Validate if configured Prefix list exists
+ if 'prefix_list' in afi_config:
+ for tmp in ['import', 'export']:
+ if tmp not in afi_config['prefix_list']:
+ # bail out early
+ continue
+ # get_config_dict() mangles all '-' characters to '_' this is legitimate, thus all our
+ # compares will run on '_' as also '_' is a valid name for a prefix-list
+ prefix_list = afi_config['prefix_list'][tmp].replace('-', '_')
+ if afi == 'ipv4_unicast':
+ if dict_search(f'policy.prefix_list.{prefix_list}', bgp) == None:
+ raise ConfigError(f'prefix-list "{prefix_list}" used for "{tmp}" does not exist!')
+ elif afi == 'ipv6_unicast':
+ if dict_search(f'policy.prefix_list6.{prefix_list}', bgp) == None:
+ raise ConfigError(f'prefix-list6 "{prefix_list}" used for "{tmp}" does not exist!')
+
+ if 'route_map' in afi_config:
+ for tmp in ['import', 'export']:
+ if tmp in afi_config['route_map']:
+ # get_config_dict() mangles all '-' characters to '_' this is legitim, thus all our
+ # compares will run on '_' as also '_' is a valid name for a route-map
+ route_map = afi_config['route_map'][tmp].replace('-', '_')
+ if dict_search(f'policy.route_map.{route_map}', bgp) == None:
+ raise ConfigError(f'route-map "{route_map}" used for "{tmp}" does not exist!')
+
+ if 'route_reflector_client' in afi_config:
+ if 'remote_as' in peer_config and bgp['local_as'] != peer_config['remote_as']:
+ raise ConfigError('route-reflector-client only supported for iBGP peers')
+ else:
+ if 'peer_group' in peer_config:
+ peer_group_as = dict_search(f'peer_group.{peer_group}.remote_as', bgp)
+ if peer_group_as != None and peer_group_as != bgp['local_as']:
+ raise ConfigError('route-reflector-client only supported for iBGP peers')
+
+ # Throw an error if a peer group is not configured for allow range
+ for prefix in dict_search('listen.range', bgp) or []:
+ # we can not use dict_search() here as prefix contains dots ...
+ if 'peer_group' not in bgp['listen']['range'][prefix]:
+ raise ConfigError(f'Listen range for prefix "{prefix}" has no peer group configured.')
+
+ peer_group = bgp['listen']['range'][prefix]['peer_group']
+ if 'peer_group' not in bgp or peer_group not in bgp['peer_group']:
+ raise ConfigError(f'Peer-group "{peer_group}" for listen range "{prefix}" does not exist!')
+
+ if not verify_remote_as(bgp['listen']['range'][prefix], bgp):
+ raise ConfigError(f'Peer-group "{peer_group}" requires remote-as to be set!')
return None
def generate(bgp):
- if not bgp:
+ if not bgp or 'deleted' in bgp:
bgp['new_frr_config'] = ''
return None
- # only one BGP AS is supported, so we can directly send the first key
- # of the config dict
- asn = list(bgp.keys())[0]
- bgp[asn]['asn'] = asn
-
- bgp['new_frr_config'] = render_to_string('frr/bgp.frr.tmpl', bgp[asn])
+ bgp['new_frr_config'] = render_to_string('frr/bgp.frr.tmpl', bgp)
return None
def apply(bgp):
# Save original configuration prior to starting any commit actions
frr_cfg = frr.FRRConfig()
frr_cfg.load_configuration(frr_daemon)
- frr_cfg.modify_section(f'^router bgp \d+$', '')
+
+ if 'vrf' in bgp:
+ vrf = bgp['vrf']
+ frr_cfg.modify_section(f'^router bgp \d+ vrf {vrf}$', '')
+ else:
+ frr_cfg.modify_section('^router bgp \d+$', '')
+
frr_cfg.add_before(r'(ip prefix-list .*|route-map .*|line vty)', bgp['new_frr_config'])
frr_cfg.commit_configuration(frr_daemon)
@@ -201,6 +213,9 @@ def apply(bgp):
for a in range(5):
frr_cfg.commit_configuration(frr_daemon)
+ # Save configuration to /run/frr/{daemon}.conf
+ frr.save_configuration(frr_daemon)
+
return None
if __name__ == '__main__':
diff --git a/src/conf_mode/protocols_isis.py b/src/conf_mode/protocols_isis.py
index b7afad473..02cf9970c 100755
--- a/src/conf_mode/protocols_isis.py
+++ b/src/conf_mode/protocols_isis.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2020 VyOS maintainers and contributors
+# Copyright (C) 2020-2021 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -17,143 +17,200 @@
import os
from sys import exit
+from sys import argv
from vyos.config import Config
+from vyos.configdict import dict_merge
from vyos.configdict import node_changed
-from vyos import ConfigError
+from vyos.configverify import verify_interface_exists
from vyos.util import call
from vyos.util import dict_search
-from vyos.template import render
+from vyos.util import get_interface_config
from vyos.template import render_to_string
+from vyos import ConfigError
from vyos import frr
from vyos import airbag
airbag.enable()
+frr_daemon = 'isisd'
+
def get_config(config=None):
if config:
conf = config
else:
conf = Config()
- base = ['protocols', 'isis']
- isis = conf.get_config_dict(base, key_mangling=('-', '_'), get_first_key=True)
+ vrf = None
+ if len(argv) > 1:
+ vrf = argv[1]
+
+ base_path = ['protocols', 'isis']
+
+ # eqivalent of the C foo ? 'a' : 'b' statement
+ base = vrf and ['vrf', 'name', vrf, 'protocols', 'isis'] or base_path
+ isis = conf.get_config_dict(base, key_mangling=('-', '_'),
+ get_first_key=True)
+
+ # Assign the name of our VRF context. This MUST be done before the return
+ # statement below, else on deletion we will delete the default instance
+ # instead of the VRF instance.
+ if vrf: isis['vrf'] = vrf
+
+ # As we no re-use this Python handler for both VRF and non VRF instances for
+ # IS-IS we need to find out if any interfaces changed so properly adjust
+ # the FRR configuration and not by acctident change interfaces from a
+ # different VRF.
+ interfaces_removed = node_changed(conf, base + ['interface'])
+ if interfaces_removed:
+ isis['interface_removed'] = list(interfaces_removed)
+
+ # Bail out early if configuration tree does not exist
+ if not conf.exists(base):
+ isis.update({'deleted' : ''})
+ return isis
+
+ # We also need some additional information from the config, prefix-lists
+ # and route-maps for instance. They will be used in verify()
+ base = ['policy']
+ tmp = conf.get_config_dict(base, key_mangling=('-', '_'))
+ # Merge policy dict into OSPF dict
+ isis = dict_merge(tmp, isis)
return isis
def verify(isis):
# bail out early - looks like removal from running config
- if not isis:
+ if not isis or 'deleted' in isis:
return None
- for process, isis_config in isis.items():
- # If more then one isis process is defined (Frr only supports one)
- # http://docs.frrouting.org/en/latest/isisd.html#isis-router
- if len(isis) > 1:
- raise ConfigError('Only one isis process can be defined')
-
- # If network entity title (net) not defined
- if 'net' not in isis_config:
- raise ConfigError('ISIS net format iso is mandatory!')
-
- # If interface not set
- if 'interface' not in isis_config:
- raise ConfigError('ISIS interface is mandatory!')
-
- # If md5 and plaintext-password set at the same time
- if 'area_password' in isis_config:
- if {'md5', 'plaintext_password'} <= set(isis_config['encryption']):
- raise ConfigError('Can not use both md5 and plaintext-password for ISIS area-password!')
-
- # If one param from delay set, but not set others
- if 'spf_delay_ietf' in isis_config:
- required_timers = ['holddown', 'init_delay', 'long_delay', 'short_delay', 'time_to_learn']
- exist_timers = []
- for elm_timer in required_timers:
- if elm_timer in isis_config['spf_delay_ietf']:
- exist_timers.append(elm_timer)
-
- exist_timers = set(required_timers).difference(set(exist_timers))
- if len(exist_timers) > 0:
- raise ConfigError('All types of delay must be specified: ' + ', '.join(exist_timers).replace('_', '-'))
-
- # If Redistribute set, but level don't set
- if 'redistribute' in isis_config:
- proc_level = isis_config.get('level','').replace('-','_')
- for proto, proto_config in isis_config.get('redistribute', {}).get('ipv4', {}).items():
+ if 'net' not in isis:
+ raise ConfigError('Network entity is mandatory!')
+
+ # last byte in IS-IS area address must be 0
+ tmp = isis['net'].split('.')
+ if int(tmp[-1]) != 0:
+ raise ConfigError('Last byte of IS-IS network entity title must always be 0!')
+
+ # If interface not set
+ if 'interface' not in isis:
+ raise ConfigError('Interface used for routing updates is mandatory!')
+
+ for interface in isis['interface']:
+ verify_interface_exists(interface)
+ if 'vrf' in isis:
+ # If interface specific options are set, we must ensure that the
+ # interface is bound to our requesting VRF. Due to the VyOS
+ # priorities the interface is bound to the VRF after creation of
+ # the VRF itself, and before any routing protocol is configured.
+ vrf = isis['vrf']
+ tmp = get_interface_config(interface)
+ if 'master' not in tmp or tmp['master'] != vrf:
+ raise ConfigError(f'Interface {interface} is not a member of VRF {vrf}!')
+
+ # If md5 and plaintext-password set at the same time
+ if 'area_password' in isis:
+ if {'md5', 'plaintext_password'} <= set(isis['encryption']):
+ raise ConfigError('Can not use both md5 and plaintext-password for ISIS area-password!')
+
+ # If one param from delay set, but not set others
+ if 'spf_delay_ietf' in isis:
+ required_timers = ['holddown', 'init_delay', 'long_delay', 'short_delay', 'time_to_learn']
+ exist_timers = []
+ for elm_timer in required_timers:
+ if elm_timer in isis['spf_delay_ietf']:
+ exist_timers.append(elm_timer)
+
+ exist_timers = set(required_timers).difference(set(exist_timers))
+ if len(exist_timers) > 0:
+ raise ConfigError('All types of delay must be specified: ' + ', '.join(exist_timers).replace('_', '-'))
+
+ # If Redistribute set, but level don't set
+ if 'redistribute' in isis:
+ proc_level = isis.get('level','').replace('-','_')
+ for afi in ['ipv4']:
+ if afi not in isis['redistribute']:
+ continue
+
+ for proto, proto_config in isis['redistribute'][afi].items():
if 'level_1' not in proto_config and 'level_2' not in proto_config:
- raise ConfigError('Redistribute level-1 or level-2 should be specified in \"protocols isis {} redistribute ipv4 {}\"'.format(process, proto))
- for redistribute_level in proto_config.keys():
- if proc_level and proc_level != 'level_1_2' and proc_level != redistribute_level:
- raise ConfigError('\"protocols isis {0} redistribute ipv4 {2} {3}\" cannot be used with \"protocols isis {0} level {1}\"'.format(process, proc_level, proto, redistribute_level))
-
- # Segment routing checks
- if dict_search('segment_routing', isis_config):
- if dict_search('segment_routing.global_block', isis_config):
- high_label_value = dict_search('segment_routing.global_block.high_label_value', isis_config)
- low_label_value = dict_search('segment_routing.global_block.low_label_value', isis_config)
- # If segment routing global block high value is blank, throw error
- if low_label_value and not high_label_value:
- raise ConfigError('Segment routing global block high value must not be left blank')
- # If segment routing global block low value is blank, throw error
- if high_label_value and not low_label_value:
- raise ConfigError('Segment routing global block low value must not be left blank')
- # If segment routing global block low value is higher than the high value, throw error
- if int(low_label_value) > int(high_label_value):
- raise ConfigError('Segment routing global block low value must be lower than high value')
-
- if dict_search('segment_routing.local_block', isis_config):
- high_label_value = dict_search('segment_routing.local_block.high_label_value', isis_config)
- low_label_value = dict_search('segment_routing.local_block.low_label_value', isis_config)
- # If segment routing local block high value is blank, throw error
- if low_label_value and not high_label_value:
- raise ConfigError('Segment routing local block high value must not be left blank')
- # If segment routing local block low value is blank, throw error
- if high_label_value and not low_label_value:
- raise ConfigError('Segment routing local block low value must not be left blank')
- # If segment routing local block low value is higher than the high value, throw error
- if int(low_label_value) > int(high_label_value):
- raise ConfigError('Segment routing local block low value must be lower than high value')
+ raise ConfigError(f'Redistribute level-1 or level-2 should be specified in ' \
+ f'"protocols isis {process} redistribute {afi} {proto}"!')
+
+ for redistr_level, redistr_config in proto_config.items():
+ if proc_level and proc_level != 'level_1_2' and proc_level != redistr_level:
+ raise ConfigError(f'"protocols isis {process} redistribute {afi} {proto} {redistr_level}" ' \
+ f'can not be used with \"protocols isis {process} level {proc_level}\"')
+
+ if 'route_map' in redistr_config:
+ name = redistr_config['route_map']
+ tmp = name.replace('-', '_')
+ if dict_search(f'policy.route_map.{tmp}', isis) == None:
+ raise ConfigError(f'Route-map {name} does not exist!')
+
+ # Segment routing checks
+ if dict_search('segment_routing.global_block', isis):
+ high_label_value = dict_search('segment_routing.global_block.high_label_value', isis)
+ low_label_value = dict_search('segment_routing.global_block.low_label_value', isis)
+
+ # If segment routing global block high value is blank, throw error
+ if (low_label_value and not high_label_value) or (high_label_value and not low_label_value):
+ raise ConfigError('Segment routing global block requires both low and high value!')
+
+ # If segment routing global block low value is higher than the high value, throw error
+ if int(low_label_value) > int(high_label_value):
+ raise ConfigError('Segment routing global block low value must be lower than high value')
+
+ if dict_search('segment_routing.local_block', isis):
+ high_label_value = dict_search('segment_routing.local_block.high_label_value', isis)
+ low_label_value = dict_search('segment_routing.local_block.low_label_value', isis)
+
+ # If segment routing local block high value is blank, throw error
+ if (low_label_value and not high_label_value) or (high_label_value and not low_label_value):
+ raise ConfigError('Segment routing local block requires both high and low value!')
+
+ # If segment routing local block low value is higher than the high value, throw error
+ if int(low_label_value) > int(high_label_value):
+ raise ConfigError('Segment routing local block low value must be lower than high value')
return None
def generate(isis):
- if not isis:
+ if not isis or 'deleted' in isis:
isis['new_frr_config'] = ''
return None
- # only one ISIS process is supported, so we can directly send the first key
- # of the config dict
- process = list(isis.keys())[0]
- isis[process]['process'] = process
-
- isis['new_frr_config'] = render_to_string('frr/isis.frr.tmpl',
- isis[process])
-
+ isis['new_frr_config'] = render_to_string('frr/isis.frr.tmpl', isis)
return None
def apply(isis):
# Save original configuration prior to starting any commit actions
frr_cfg = frr.FRRConfig()
- frr_cfg.load_configuration(daemon='isisd')
- frr_cfg.modify_section(r'interface \S+', '')
- frr_cfg.modify_section(f'router isis \S+', '')
+ frr_cfg.load_configuration(frr_daemon)
+
+ # Generate empty helper string which can be ammended to FRR commands,
+ # it will be either empty (default VRF) or contain the "vrf <name" statement
+ vrf = ''
+ if 'vrf' in isis:
+ vrf = ' vrf ' + isis['vrf']
+
+ frr_cfg.modify_section(f'^router isis VyOS{vrf}$', '')
+ for key in ['interface', 'interface_removed']:
+ if key not in isis:
+ continue
+ for interface in isis[key]:
+ frr_cfg.modify_section(f'^interface {interface}{vrf}$', '')
+
frr_cfg.add_before(r'(ip prefix-list .*|route-map .*|line vty)', isis['new_frr_config'])
- frr_cfg.commit_configuration(daemon='isisd')
+ frr_cfg.commit_configuration(frr_daemon)
# If FRR config is blank, rerun the blank commit x times due to frr-reload
# behavior/bug not properly clearing out on one commit.
if isis['new_frr_config'] == '':
for a in range(5):
- frr_cfg.commit_configuration(daemon='isisd')
-
- # Debugging
- '''
- print('')
- print('--------- DEBUGGING ----------')
- print(f'Existing config:\n{frr_cfg["original_config"]}\n\n')
- print(f'Replacement config:\n{isis["new_frr_config"]}\n\n')
- print(f'Modified config:\n{frr_cfg["modified_config"]}\n\n')
- '''
+ frr_cfg.commit_configuration(frr_daemon)
+
+ # Save configuration to /run/frr/{daemon}.conf
+ frr.save_configuration(frr_daemon)
return None
diff --git a/src/conf_mode/protocols_ospf.py b/src/conf_mode/protocols_ospf.py
index aefe7c23e..b4ee8659a 100755
--- a/src/conf_mode/protocols_ospf.py
+++ b/src/conf_mode/protocols_ospf.py
@@ -17,14 +17,17 @@
import os
from sys import exit
+from sys import argv
from vyos.config import Config
from vyos.configdict import dict_merge
+from vyos.configdict import node_changed
from vyos.configverify import verify_route_maps
from vyos.configverify import verify_interface_exists
from vyos.template import render_to_string
from vyos.util import call
from vyos.util import dict_search
+from vyos.util import get_interface_config
from vyos.xml import defaults
from vyos import ConfigError
from vyos import frr
@@ -38,16 +41,42 @@ def get_config(config=None):
conf = config
else:
conf = Config()
- base = ['protocols', 'ospf']
- ospf = conf.get_config_dict(base, key_mangling=('-', '_'), get_first_key=True)
+
+ vrf = None
+ if len(argv) > 1:
+ vrf = argv[1]
+
+ base_path = ['protocols', 'ospf']
+
+ # eqivalent of the C foo ? 'a' : 'b' statement
+ base = vrf and ['vrf', 'name', vrf, 'protocols', 'ospf'] or base_path
+ ospf = conf.get_config_dict(base, key_mangling=('-', '_'),
+ get_first_key=True)
+
+ # Assign the name of our VRF context. This MUST be done before the return
+ # statement below, else on deletion we will delete the default instance
+ # instead of the VRF instance.
+ if vrf: ospf['vrf'] = vrf
+
+ # As we no re-use this Python handler for both VRF and non VRF instances for
+ # OSPF we need to find out if any interfaces changed so properly adjust
+ # the FRR configuration and not by acctident change interfaces from a
+ # different VRF.
+ interfaces_removed = node_changed(conf, base + ['interface'])
+ if interfaces_removed:
+ ospf['interface_removed'] = list(interfaces_removed)
# Bail out early if configuration tree does not exist
if not conf.exists(base):
+ ospf.update({'deleted' : ''})
return ospf
# We have gathered the dict representation of the CLI, but there are default
# options which we need to update into the dictionary retrived.
- default_values = defaults(base)
+ # XXX: Note that we can not call defaults(base), as defaults does not work
+ # on an instance of a tag node. As we use the exact same CLI definition for
+ # both the non-vrf and vrf version this is absolutely safe!
+ default_values = defaults(base_path)
# We have to cleanup the default dict, as default values could enable features
# which are not explicitly enabled on the CLI. Example: default-information
@@ -63,6 +92,7 @@ def get_config(config=None):
for protocol in ['bgp', 'connected', 'isis', 'kernel', 'rip', 'static']:
if dict_search(f'redistribute.{protocol}', ospf) is None:
del default_values['redistribute'][protocol]
+
# XXX: T2665: we currently have no nice way for defaults under tag nodes,
# clean them out and add them manually :(
del default_values['neighbor']
@@ -121,12 +151,22 @@ def verify(ospf):
# time. FRR will only activate the last option set via CLI.
if {'hello_multiplier', 'dead_interval'} <= set(ospf['interface'][interface]):
raise ConfigError(f'Can not use hello-multiplier and dead-interval ' \
- f'concurrently for "{interface}"!')
+ f'concurrently for {interface}!')
+
+ if 'vrf' in ospf:
+ # If interface specific options are set, we must ensure that the
+ # interface is bound to our requesting VRF. Due to the VyOS
+ # priorities the interface is bound to the VRF after creation of
+ # the VRF itself, and before any routing protocol is configured.
+ vrf = ospf['vrf']
+ tmp = get_interface_config(interface)
+ if 'master' not in tmp or tmp['master'] != vrf:
+ raise ConfigError(f'Interface {interface} is not a member of VRF {vrf}!')
return None
def generate(ospf):
- if not ospf:
+ if not ospf or 'deleted' in ospf:
ospf['new_frr_config'] = ''
return None
@@ -137,8 +177,20 @@ def apply(ospf):
# Save original configuration prior to starting any commit actions
frr_cfg = frr.FRRConfig()
frr_cfg.load_configuration(frr_daemon)
- frr_cfg.modify_section(r'^interface \S+', '')
- frr_cfg.modify_section('^router ospf$', '')
+
+ # Generate empty helper string which can be ammended to FRR commands,
+ # it will be either empty (default VRF) or contain the "vrf <name" statement
+ vrf = ''
+ if 'vrf' in ospf:
+ vrf = ' vrf ' + ospf['vrf']
+
+ frr_cfg.modify_section(f'^router ospf{vrf}$', '')
+ for key in ['interface', 'interface_removed']:
+ if key not in ospf:
+ continue
+ for interface in ospf[key]:
+ frr_cfg.modify_section(f'^interface {interface}{vrf}$', '')
+
frr_cfg.add_before(r'(ip prefix-list .*|route-map .*|line vty)', ospf['new_frr_config'])
frr_cfg.commit_configuration(frr_daemon)
@@ -148,6 +200,9 @@ def apply(ospf):
for a in range(5):
frr_cfg.commit_configuration(frr_daemon)
+ # Save configuration to /run/frr/{daemon}.conf
+ frr.save_configuration(frr_daemon)
+
return None
if __name__ == '__main__':
diff --git a/src/conf_mode/protocols_ospfv3.py b/src/conf_mode/protocols_ospfv3.py
index 6f068b196..f3beab204 100755
--- a/src/conf_mode/protocols_ospfv3.py
+++ b/src/conf_mode/protocols_ospfv3.py
@@ -91,6 +91,9 @@ def apply(ospfv3):
for a in range(5):
frr_cfg.commit_configuration(frr_daemon)
+ # Save configuration to /run/frr/{daemon}.conf
+ frr.save_configuration(frr_daemon)
+
return None
if __name__ == '__main__':
diff --git a/src/conf_mode/protocols_rip.py b/src/conf_mode/protocols_rip.py
index 6db5143c5..34d42d630 100755
--- a/src/conf_mode/protocols_rip.py
+++ b/src/conf_mode/protocols_rip.py
@@ -116,6 +116,9 @@ def apply(rip):
for a in range(5):
frr_cfg.commit_configuration(frr_daemon)
+ # Save configuration to /run/frr/{daemon}.conf
+ frr.save_configuration(frr_daemon)
+
return None
if __name__ == '__main__':
diff --git a/src/conf_mode/protocols_ripng.py b/src/conf_mode/protocols_ripng.py
index 8cc5de64a..eff4297f9 100755
--- a/src/conf_mode/protocols_ripng.py
+++ b/src/conf_mode/protocols_ripng.py
@@ -57,8 +57,6 @@ def get_config(config=None):
# Merge policy dict into OSPF dict
ripng = dict_merge(tmp, ripng)
- import pprint
- pprint.pprint(ripng)
return ripng
def verify(ripng):
@@ -99,9 +97,6 @@ def generate(ripng):
return None
ripng['new_frr_config'] = render_to_string('frr/ripng.frr.tmpl', ripng)
- import pprint
- pprint.pprint(ripng['new_frr_config'])
-
return None
def apply(ripng):
@@ -120,6 +115,9 @@ def apply(ripng):
for a in range(5):
frr_cfg.commit_configuration(frr_daemon)
+ # Save configuration to /run/frr/{daemon}.conf
+ frr.save_configuration(frr_daemon)
+
return None
if __name__ == '__main__':
diff --git a/src/conf_mode/protocols_static.py b/src/conf_mode/protocols_static.py
index 5d101b33e..0de073a6d 100755
--- a/src/conf_mode/protocols_static.py
+++ b/src/conf_mode/protocols_static.py
@@ -17,11 +17,13 @@
import os
from sys import exit
+from sys import argv
from vyos.config import Config
+from vyos.configverify import verify_route_maps
+from vyos.configverify import verify_vrf
from vyos.template import render_to_string
from vyos.util import call
-from vyos.configverify import verify_route_maps
from vyos import ConfigError
from vyos import frr
from vyos import airbag
@@ -34,12 +36,40 @@ def get_config(config=None):
conf = config
else:
conf = Config()
- base = ['protocols', 'static']
+
+ vrf = None
+ if len(argv) > 1:
+ vrf = argv[1]
+
+ base_path = ['protocols', 'static']
+ # eqivalent of the C foo ? 'a' : 'b' statement
+ base = vrf and ['vrf', 'name', vrf, 'protocols', 'static'] or base_path
static = conf.get_config_dict(base, key_mangling=('-', '_'), get_first_key=True)
+
+ # Assign the name of our VRF context
+ if vrf: static['vrf'] = vrf
+
return static
def verify(static):
verify_route_maps(static)
+
+ for route in ['route', 'route6']:
+ # if there is no route(6) key in the dictionary we can immediately
+ # bail out early
+ if route not in static:
+ continue
+
+ # When leaking routes to other VRFs we must ensure that the destination
+ # VRF exists
+ for prefix, prefix_options in static[route].items():
+ # both the interface and next-hop CLI node can have a VRF subnode,
+ # thus we check this using a for loop
+ for type in ['interface', 'next_hop']:
+ if type in prefix_options:
+ for interface, interface_config in prefix_options[type].items():
+ verify_vrf(interface_config)
+
return None
def generate(static):
@@ -50,8 +80,14 @@ def apply(static):
# Save original configuration prior to starting any commit actions
frr_cfg = frr.FRRConfig()
frr_cfg.load_configuration(frr_daemon)
- frr_cfg.modify_section(r'^ip route .*', '')
- frr_cfg.modify_section(r'^ipv6 route .*', '')
+
+ if 'vrf' in static:
+ vrf = static['vrf']
+ frr_cfg.modify_section(f'^vrf {vrf}$', '')
+ else:
+ frr_cfg.modify_section(r'^ip route .*', '')
+ frr_cfg.modify_section(r'^ipv6 route .*', '')
+
frr_cfg.add_before(r'(interface .*|line vty)', static['new_frr_config'])
frr_cfg.commit_configuration(frr_daemon)
@@ -61,6 +97,9 @@ def apply(static):
for a in range(5):
frr_cfg.commit_configuration(frr_daemon)
+ # Save configuration to /run/frr/{daemon}.conf
+ frr.save_configuration(frr_daemon)
+
return None
if __name__ == '__main__':
diff --git a/src/conf_mode/protocols_vrf.py b/src/conf_mode/protocols_vrf.py
deleted file mode 100755
index 227e7d5e1..000000000
--- a/src/conf_mode/protocols_vrf.py
+++ /dev/null
@@ -1,72 +0,0 @@
-#!/usr/bin/env python3
-#
-# Copyright (C) 2021 VyOS maintainers and contributors
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU General Public License version 2 or later as
-# published by the Free Software Foundation.
-#
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY; without even the implied warranty of
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-# GNU General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program. If not, see <http://www.gnu.org/licenses/>.
-
-import os
-
-from sys import exit
-
-from vyos.config import Config
-from vyos.template import render_to_string
-from vyos.util import call
-from vyos import ConfigError
-from vyos import frr
-from vyos import airbag
-airbag.enable()
-
-frr_daemon = 'staticd'
-
-def get_config(config=None):
- if config:
- conf = config
- else:
- conf = Config()
- base = ['protocols', 'vrf']
- vrf = conf.get_config_dict(base, key_mangling=('-', '_'))
- return vrf
-
-def verify(vrf):
-
- return None
-
-def generate(vrf):
- vrf['new_frr_config'] = render_to_string('frr/vrf.frr.tmpl', vrf)
- return None
-
-def apply(vrf):
- # Save original configuration prior to starting any commit actions
- frr_cfg = frr.FRRConfig()
- frr_cfg.load_configuration(frr_daemon)
- frr_cfg.modify_section(r'vrf \S+', '')
- frr_cfg.add_before(r'(ip prefix-list .*|route-map .*|line vty)', vrf['new_frr_config'])
- frr_cfg.commit_configuration(frr_daemon)
-
- # If FRR config is blank, rerun the blank commit x times due to frr-reload
- # behavior/bug not properly clearing out on one commit.
- if vrf['new_frr_config'] == '':
- for a in range(5):
- frr_cfg.commit_configuration(frr_daemon)
-
- return None
-
-if __name__ == '__main__':
- try:
- c = get_config()
- verify(c)
- generate(c)
- apply(c)
- except ConfigError as e:
- print(e)
- exit(1)
diff --git a/src/conf_mode/service_console-server.py b/src/conf_mode/service_console-server.py
index 6e94a19ae..51050e702 100755
--- a/src/conf_mode/service_console-server.py
+++ b/src/conf_mode/service_console-server.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python3
#
-# Copyright (C) 2018-2020 VyOS maintainers and contributors
+# Copyright (C) 2018-2021 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -17,6 +17,7 @@
import os
from sys import exit
+from psutil import process_iter
from vyos.config import Config
from vyos.configdict import dict_merge
@@ -60,14 +61,19 @@ def verify(proxy):
if not proxy:
return None
+ processes = process_iter(['name', 'cmdline'])
if 'device' in proxy:
- for device in proxy['device']:
- if 'speed' not in proxy['device'][device]:
- raise ConfigError(f'Serial port speed must be defined for "{device}"!')
+ for device, device_config in proxy['device'].items():
+ for process in processes:
+ if 'agetty' in process.name() and device in process.cmdline():
+ raise ConfigError(f'Port "{device}" already provides a '\
+ 'console used by "system console"!')
+
+ if 'speed' not in device_config:
+ raise ConfigError(f'Port "{device}" requires speed to be set!')
- if 'ssh' in proxy['device'][device]:
- if 'port' not in proxy['device'][device]['ssh']:
- raise ConfigError(f'SSH port must be defined for "{device}"!')
+ if 'ssh' in device_config and 'port' not in device_config['ssh']:
+ raise ConfigError(f'Port "{device}" requires SSH port to be set!')
return None
@@ -77,13 +83,13 @@ def generate(proxy):
render(config_file, 'conserver/conserver.conf.tmpl', proxy)
if 'device' in proxy:
- for device in proxy['device']:
- if 'ssh' not in proxy['device'][device]:
+ for device, device_config in proxy['device'].items():
+ if 'ssh' not in device_config:
continue
tmp = {
'device' : device,
- 'port' : proxy['device'][device]['ssh']['port'],
+ 'port' : device_config['ssh']['port'],
}
render(dropbear_systemd_file.format(**tmp),
'conserver/dropbear@.service.tmpl', tmp)
@@ -102,10 +108,10 @@ def apply(proxy):
call('systemctl restart conserver-server.service')
if 'device' in proxy:
- for device in proxy['device']:
- if 'ssh' not in proxy['device'][device]:
+ for device, device_config in proxy['device'].items():
+ if 'ssh' not in device_config:
continue
- port = proxy['device'][device]['ssh']['port']
+ port = device_config['ssh']['port']
call(f'systemctl restart dropbear@{port}.service')
return None
diff --git a/src/conf_mode/vrf.py b/src/conf_mode/vrf.py
index 6c6e219a5..414e514c5 100755
--- a/src/conf_mode/vrf.py
+++ b/src/conf_mode/vrf.py
@@ -23,17 +23,16 @@ from vyos.config import Config
from vyos.configdict import node_changed
from vyos.ifconfig import Interface
from vyos.template import render
+from vyos.util import call
from vyos.util import cmd
from vyos.util import dict_search
+from vyos.util import get_interface_config
from vyos import ConfigError
from vyos import airbag
airbag.enable()
config_file = r'/etc/iproute2/rt_tables.d/vyos-vrf.conf'
-def _cmd(command):
- cmd(command, raising=ConfigError, message='Error changing VRF')
-
def list_rules():
command = 'ip -j -4 rule show'
answer = loads(cmd(command))
@@ -111,8 +110,7 @@ def verify(vrf):
# routing table id can't be changed - OS restriction
if os.path.isdir(f'/sys/class/net/{name}'):
- tmp = loads(cmd(f'ip -j -d link show {name}'))[0]
- tmp = str(dict_search('linkinfo.info_data.table', tmp))
+ tmp = str(dict_search('linkinfo.info_data.table', get_interface_config(name)))
if tmp and tmp != config['table']:
raise ConfigError(f'VRF "{name}" table id modification not possible!')
@@ -140,14 +138,14 @@ def apply(vrf):
bind_all = '0'
if 'bind_to_all' in vrf:
bind_all = '1'
- _cmd(f'sysctl -wq net.ipv4.tcp_l3mdev_accept={bind_all}')
- _cmd(f'sysctl -wq net.ipv4.udp_l3mdev_accept={bind_all}')
+ call(f'sysctl -wq net.ipv4.tcp_l3mdev_accept={bind_all}')
+ call(f'sysctl -wq net.ipv4.udp_l3mdev_accept={bind_all}')
for tmp in (dict_search('vrf_remove', vrf) or []):
if os.path.isdir(f'/sys/class/net/{tmp}'):
- _cmd(f'ip -4 route del vrf {tmp} unreachable default metric 4278198272')
- _cmd(f'ip -6 route del vrf {tmp} unreachable default metric 4278198272')
- _cmd(f'ip link delete dev {tmp}')
+ call(f'ip -4 route del vrf {tmp} unreachable default metric 4278198272')
+ call(f'ip -6 route del vrf {tmp} unreachable default metric 4278198272')
+ call(f'ip link delete dev {tmp}')
if 'name' in vrf:
for name, config in vrf['name'].items():
@@ -156,16 +154,16 @@ def apply(vrf):
if not os.path.isdir(f'/sys/class/net/{name}'):
# For each VRF apart from your default context create a VRF
# interface with a separate routing table
- _cmd(f'ip link add {name} type vrf table {table}')
+ call(f'ip link add {name} type vrf table {table}')
# The kernel Documentation/networking/vrf.txt also recommends
# adding unreachable routes to the VRF routing tables so that routes
# afterwards are taken.
- _cmd(f'ip -4 route add vrf {name} unreachable default metric 4278198272')
- _cmd(f'ip -6 route add vrf {name} unreachable default metric 4278198272')
+ call(f'ip -4 route add vrf {name} unreachable default metric 4278198272')
+ call(f'ip -6 route add vrf {name} unreachable default metric 4278198272')
# We also should add proper loopback IP addresses to the newly
# created VRFs for services bound to the loopback address (SNMP, NTP)
- _cmd(f'ip -4 addr add 127.0.0.1/8 dev {name}')
- _cmd(f'ip -6 addr add ::1/128 dev {name}')
+ call(f'ip -4 addr add 127.0.0.1/8 dev {name}')
+ call(f'ip -6 addr add ::1/128 dev {name}')
# set VRF description for e.g. SNMP monitoring
vrf_if = Interface(name)
@@ -199,18 +197,18 @@ def apply(vrf):
# change preference when VRFs are enabled and local lookup table is default
if not local_pref and 'name' in vrf:
for af in ['-4', '-6']:
- _cmd(f'ip {af} rule add pref 32765 table local')
- _cmd(f'ip {af} rule del pref 0')
+ call(f'ip {af} rule add pref 32765 table local')
+ call(f'ip {af} rule del pref 0')
# return to default lookup preference when no VRF is configured
if 'name' not in vrf:
for af in ['-4', '-6']:
- _cmd(f'ip {af} rule add pref 0 table local')
- _cmd(f'ip {af} rule del pref 32765')
+ call(f'ip {af} rule add pref 0 table local')
+ call(f'ip {af} rule del pref 32765')
# clean out l3mdev-table rule if present
if 1000 in [r.get('priority') for r in list_rules() if r.get('priority') == 1000]:
- _cmd(f'ip {af} rule del pref 1000')
+ call(f'ip {af} rule del pref 1000')
return None
diff --git a/src/etc/udev/rules.d/99-vyos-wwan.rules b/src/etc/udev/rules.d/99-vyos-wwan.rules
new file mode 100644
index 000000000..67f30a3dd
--- /dev/null
+++ b/src/etc/udev/rules.d/99-vyos-wwan.rules
@@ -0,0 +1,11 @@
+ACTION!="add|change", GOTO="mbim_to_qmi_rules_end"
+
+SUBSYSTEM!="usb", GOTO="mbim_to_qmi_rules_end"
+
+# ignore any device with only one configuration
+ATTR{bNumConfigurations}=="1", GOTO="mbim_to_qmi_rules_end"
+
+# force Sierra Wireless MC7710 to configuration #1
+ATTR{idVendor}=="1199",ATTR{idProduct}=="68a2",ATTR{bConfigurationValue}="1"
+
+LABEL="mbim_to_qmi_rules_end"
diff --git a/src/migration-scripts/bgp/0-to-1 b/src/migration-scripts/bgp/0-to-1
new file mode 100755
index 000000000..b1d5a6514
--- /dev/null
+++ b/src/migration-scripts/bgp/0-to-1
@@ -0,0 +1,60 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2021 VyOS maintainers and contributors
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or later as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# T3417: migrate IS-IS tagNode to node as we can only have one IS-IS process
+
+from sys import argv
+from sys import exit
+
+from vyos.configtree import ConfigTree
+
+if (len(argv) < 1):
+ print("Must specify file name!")
+ exit(1)
+
+file_name = argv[1]
+
+with open(file_name, 'r') as f:
+ config_file = f.read()
+
+base = ['protocols', 'bgp']
+config = ConfigTree(config_file)
+
+if not config.exists(base):
+ # Nothing to do
+ exit(0)
+
+# Only one BGP process is supported, thus this operation is savea
+asn = config.list_nodes(base)
+bgp_base = base + asn
+
+# We need a temporary copy of the config
+tmp_base = ['protocols', 'bgp2']
+config.copy(bgp_base, tmp_base)
+
+# Now it's save to delete the old configuration
+config.delete(base)
+
+# Rename temporary copy to new final config and set new "local-as" option
+config.rename(tmp_base, 'bgp')
+config.set(base + ['local-as'], value=asn[0])
+
+try:
+ with open(file_name, 'w') as f:
+ f.write(config.to_string())
+except OSError as e:
+ print(f'Failed to save the modified config: {e}')
+ exit(1)
diff --git a/src/migration-scripts/isis/0-to-1 b/src/migration-scripts/isis/0-to-1
new file mode 100755
index 000000000..93cbbbed5
--- /dev/null
+++ b/src/migration-scripts/isis/0-to-1
@@ -0,0 +1,59 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2021 VyOS maintainers and contributors
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or later as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# T3417: migrate IS-IS tagNode to node as we can only have one IS-IS process
+
+from sys import argv
+from sys import exit
+
+from vyos.configtree import ConfigTree
+
+if (len(argv) < 1):
+ print("Must specify file name!")
+ exit(1)
+
+file_name = argv[1]
+
+with open(file_name, 'r') as f:
+ config_file = f.read()
+
+base = ['protocols', 'isis']
+config = ConfigTree(config_file)
+
+if not config.exists(base):
+ # Nothing to do
+ exit(0)
+
+# Only one IS-IS process is supported, thus this operation is save
+isis_base = base + config.list_nodes(base)
+
+# We need a temporary copy of the config
+tmp_base = ['protocols', 'isis2']
+config.copy(isis_base, tmp_base)
+
+# Now it's save to delete the old configuration
+config.delete(base)
+
+# Rename temporary copy to new final config (IS-IS domain key is static and no
+# longer required to be set via CLI)
+config.rename(tmp_base, 'isis')
+
+try:
+ with open(file_name, 'w') as f:
+ f.write(config.to_string())
+except OSError as e:
+ print(f'Failed to save the modified config: {e}')
+ exit(1)
diff --git a/src/migration-scripts/vrf/1-to-2 b/src/migration-scripts/vrf/1-to-2
new file mode 100755
index 000000000..20128e957
--- /dev/null
+++ b/src/migration-scripts/vrf/1-to-2
@@ -0,0 +1,61 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2021 VyOS maintainers and contributors
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or later as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+# - T3344: migrate routing options from "protocols vrf" to "vrf <name> protocols"
+
+from sys import argv
+from sys import exit
+from vyos.configtree import ConfigTree
+
+if (len(argv) < 2):
+ print("Must specify file name!")
+ exit(1)
+
+file_name = argv[1]
+
+with open(file_name, 'r') as f:
+ config_file = f.read()
+
+base = ['protocols', 'vrf']
+config = ConfigTree(config_file)
+
+if not config.exists(base):
+ # Nothing to do
+ exit(0)
+
+vrf_base = ['vrf', 'name']
+config.set(vrf_base)
+config.set_tag(vrf_base)
+
+# Copy all existing static routes to the new base node under "vrf name <name> protocols static"
+for vrf in config.list_nodes(base):
+ static_base = base + [vrf, 'static']
+ if not config.exists(static_base):
+ continue
+
+ new_static_base = vrf_base + [vrf, 'protocols']
+ config.set(new_static_base)
+ config.copy(static_base, new_static_base + ['static'])
+
+# Now delete the old configuration
+config.delete(base)
+
+try:
+ with open(file_name, 'w') as f:
+ f.write(config.to_string())
+except OSError as e:
+ print("Failed to save the modified config: {}".format(e))
+ exit(1)
diff --git a/src/op_mode/ppp-server-ctrl.py b/src/op_mode/ppp-server-ctrl.py
index 171107b4a..670cdf879 100755
--- a/src/op_mode/ppp-server-ctrl.py
+++ b/src/op_mode/ppp-server-ctrl.py
@@ -59,7 +59,10 @@ def main():
output, err = popen(cmd_dict['cmd_base'].format(cmd_dict['vpn_types'][args.proto]) + args.action + ses_pattern, stderr=DEVNULL, decode='utf-8')
if not err:
- print(output)
+ try:
+ print(output)
+ except:
+ sys.exit(0)
else:
print("{} server is not running".format(args.proto))
diff --git a/src/op_mode/show_ipsec_sa.py b/src/op_mode/show_ipsec_sa.py
index b7927fcc2..066e36b5e 100755
--- a/src/op_mode/show_ipsec_sa.py
+++ b/src/op_mode/show_ipsec_sa.py
@@ -70,6 +70,7 @@ for sa in sas:
else:
for csa in installed_sas:
isa = installed_sas[csa]
+ csa_name = isa['name']
bytes_in = hurry.filesize.size(int(isa["bytes-in"].decode()))
bytes_out = hurry.filesize.size(int(isa["bytes-out"].decode()))
@@ -103,7 +104,7 @@ for sa in sas:
if dh_group:
proposal = "{0}/{1}".format(proposal, dh_group)
- data = [peer, state, uptime, bytes_str, pkts_str, remote_host, remote_id, proposal]
+ data = [csa_name, state, uptime, bytes_str, pkts_str, remote_host, remote_id, proposal]
sa_data.append(data)
headers = ["Connection", "State", "Uptime", "Bytes In/Out", "Packets In/Out", "Remote address", "Remote ID", "Proposal"]
diff --git a/src/op_mode/show_nat66_rules.py b/src/op_mode/show_nat66_rules.py
new file mode 100755
index 000000000..fe5113015
--- /dev/null
+++ b/src/op_mode/show_nat66_rules.py
@@ -0,0 +1,80 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2021 VyOS maintainers and contributors
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or later as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import jmespath
+import json
+
+from argparse import ArgumentParser
+from jinja2 import Template
+from sys import exit
+from vyos.util import cmd
+from vyos.util import dict_search
+
+parser = ArgumentParser()
+group = parser.add_mutually_exclusive_group()
+group.add_argument("--source", help="Show statistics for configured source NAT rules", action="store_true")
+group.add_argument("--destination", help="Show statistics for configured destination NAT rules", action="store_true")
+args = parser.parse_args()
+
+if args.source or args.destination:
+ tmp = cmd('sudo nft -j list table ip6 nat')
+ tmp = json.loads(tmp)
+
+ format_nat66_rule = '{0: <10} {1: <50} {2: <50} {3: <10}'
+ print(format_nat66_rule.format("Rule", "Source" if args.source else "Destination", "Translation", "Outbound Interface" if args.source else "Inbound Interface"))
+ print(format_nat66_rule.format("----", "------" if args.source else "-----------", "-----------", "------------------" if args.source else "-----------------"))
+
+ data_json = jmespath.search('nftables[?rule].rule[?chain]', tmp)
+ for idx in range(0, len(data_json)):
+ data = data_json[idx]
+
+ # If there is no index 3, we don't think this is the record we need to check
+ if len(data['expr']) <= 3:
+ continue
+
+ comment = data['comment']
+ rule = comment.replace('SRC-NAT66-','')
+ rule = rule.replace('DST-NAT66-','')
+ chain = data['chain']
+ if not (args.source and chain == 'POSTROUTING') or (not args.source and chain == 'PREROUTING'):
+ continue
+ interface = dict_search('match.right', data['expr'][0])
+ srcdest = dict_search('match.right.prefix.addr', data['expr'][2])
+ if srcdest:
+ addr_tmp = dict_search('match.right.prefix.len', data['expr'][2])
+ if addr_tmp:
+ srcdest = srcdest + '/' + str(addr_tmp)
+ else:
+ srcdest = dict_search('match.right', data['expr'][2])
+
+ tran_addr = dict_search('snat.addr.prefix.addr' if args.source else 'dnat.addr.prefix.addr', data['expr'][3])
+ if tran_addr:
+ addr_tmp = dict_search('snat.addr.prefix.len' if args.source else 'dnat.addr.prefix.len', data['expr'][3])
+ if addr_tmp:
+ srcdest = srcdest + '/' + str(addr_tmp)
+ else:
+ if 'masquerade' in data['expr'][3]:
+ tran_addr = 'masquerade'
+ else:
+ tran_addr = dict_search('snat.addr' if args.source else 'dnat.addr', data['expr'][3])
+
+ print(format_nat66_rule.format(rule, srcdest, tran_addr, interface))
+
+ exit(0)
+else:
+ parser.print_help()
+ exit(1)
+
diff --git a/src/op_mode/show_nat66_statistics.py b/src/op_mode/show_nat66_statistics.py
new file mode 100755
index 000000000..bc81692ae
--- /dev/null
+++ b/src/op_mode/show_nat66_statistics.py
@@ -0,0 +1,63 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2018 VyOS maintainers and contributors
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or later as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import jmespath
+import json
+
+from argparse import ArgumentParser
+from jinja2 import Template
+from sys import exit
+from vyos.util import cmd
+
+OUT_TMPL_SRC="""
+rule pkts bytes interface
+---- ---- ----- ---------
+{% for r in output %}
+{% if r.comment %}
+{% set packets = r.counter.packets %}
+{% set bytes = r.counter.bytes %}
+{% set interface = r.interface %}
+{# remove rule comment prefix #}
+{% set comment = r.comment | replace('SRC-NAT66-', '') | replace('DST-NAT66-', '') %}
+{{ "%-4s" | format(comment) }} {{ "%9s" | format(packets) }} {{ "%12s" | format(bytes) }} {{ interface }}
+{% endif %}
+{% endfor %}
+"""
+
+parser = ArgumentParser()
+group = parser.add_mutually_exclusive_group()
+group.add_argument("--source", help="Show statistics for configured source NAT rules", action="store_true")
+group.add_argument("--destination", help="Show statistics for configured destination NAT rules", action="store_true")
+args = parser.parse_args()
+
+if args.source or args.destination:
+ tmp = cmd('sudo nft -j list table ip6 nat')
+ tmp = json.loads(tmp)
+
+ source = r"nftables[?rule.chain=='POSTROUTING'].rule.{chain: chain, handle: handle, comment: comment, counter: expr[].counter | [0], interface: expr[].match.right | [0] }"
+ destination = r"nftables[?rule.chain=='PREROUTING'].rule.{chain: chain, handle: handle, comment: comment, counter: expr[].counter | [0], interface: expr[].match.right | [0] }"
+ data = {
+ 'output' : jmespath.search(source if args.source else destination, tmp),
+ 'direction' : 'source' if args.source else 'destination'
+ }
+
+ tmpl = Template(OUT_TMPL_SRC, lstrip_blocks=True)
+ print(tmpl.render(data))
+ exit(0)
+else:
+ parser.print_help()
+ exit(1)
+
diff --git a/src/op_mode/show_nat66_translations.py b/src/op_mode/show_nat66_translations.py
new file mode 100755
index 000000000..045d64065
--- /dev/null
+++ b/src/op_mode/show_nat66_translations.py
@@ -0,0 +1,204 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2020 VyOS maintainers and contributors
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or later as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+'''
+show nat translations
+'''
+
+import os
+import sys
+import ipaddress
+import argparse
+import xmltodict
+
+from vyos.util import popen
+from vyos.util import DEVNULL
+
+conntrack = '/usr/sbin/conntrack'
+
+verbose_format = "%-20s %-18s %-20s %-18s"
+normal_format = "%-20s %-20s %-4s %-8s %s"
+
+
+def headers(verbose, pipe):
+ if verbose:
+ return verbose_format % ('Pre-NAT src', 'Pre-NAT dst', 'Post-NAT src', 'Post-NAT dst')
+ return normal_format % ('Pre-NAT', 'Post-NAT', 'Prot', 'Timeout', 'Type' if pipe else '')
+
+
+def command(srcdest, proto, ipaddr):
+ command = f'{conntrack} -o xml -L -f ipv6'
+
+ if proto:
+ command += f' -p {proto}'
+
+ if srcdest == 'source':
+ command += ' -n'
+ if ipaddr:
+ command += f' --orig-src {ipaddr}'
+ if srcdest == 'destination':
+ command += ' -g'
+ if ipaddr:
+ command += f' --orig-dst {ipaddr}'
+
+ return command
+
+
+def run(command):
+ xml, code = popen(command,stderr=DEVNULL)
+ if code:
+ sys.exit('conntrack failed')
+ return xml
+
+
+def content(xmlfile):
+ xml = ''
+ with open(xmlfile,'r') as r:
+ xml += r.read()
+ return xml
+
+
+def pipe():
+ xml = ''
+ while True:
+ line = sys.stdin.readline()
+ xml += line
+ if '</conntrack>' in line:
+ break
+
+ sys.stdin = open('/dev/tty')
+ return xml
+
+
+def process(data, stats, protocol, pipe, verbose, flowtype=''):
+ if not data:
+ return
+
+ parsed = xmltodict.parse(data)
+
+ print(headers(verbose, pipe))
+
+ # to help the linter to detect typos
+ ORIGINAL = 'original'
+ REPLY = 'reply'
+ INDEPENDANT = 'independent'
+ SPORT = 'sport'
+ DPORT = 'dport'
+ SRC = 'src'
+ DST = 'dst'
+
+ for rule in parsed['conntrack']['flow']:
+ src, dst, sport, dport, proto = {}, {}, {}, {}, {}
+ packet_count, byte_count = {}, {}
+ timeout, use = 0, 0
+
+ rule_type = rule.get('type', '')
+
+ for meta in rule['meta']:
+ # print(meta)
+ direction = meta['@direction']
+
+ if direction in (ORIGINAL, REPLY):
+ if 'layer3' in meta:
+ l3 = meta['layer3']
+ src[direction] = l3[SRC]
+ dst[direction] = l3[DST]
+
+ if 'layer4' in meta:
+ l4 = meta['layer4']
+ sp = l4.get(SPORT, '')
+ dp = l4.get(DPORT, '')
+ if sp:
+ sport[direction] = sp
+ if dp:
+ dport[direction] = dp
+ proto[direction] = l4.get('@protoname','')
+
+ if stats and 'counters' in meta:
+ packet_count[direction] = meta['packets']
+ byte_count[direction] = meta['bytes']
+ continue
+
+ if direction == INDEPENDANT:
+ timeout = meta['timeout']
+ use = meta['use']
+ continue
+
+ in_src = '%s:%s' % (src[ORIGINAL], sport[ORIGINAL]) if ORIGINAL in sport else src[ORIGINAL]
+ in_dst = '%s:%s' % (dst[ORIGINAL], dport[ORIGINAL]) if ORIGINAL in dport else dst[ORIGINAL]
+
+ # inverted the the perl code !!?
+ out_dst = '%s:%s' % (dst[REPLY], dport[REPLY]) if REPLY in dport else dst[REPLY]
+ out_src = '%s:%s' % (src[REPLY], sport[REPLY]) if REPLY in sport else src[REPLY]
+
+ if flowtype == 'source':
+ v = ORIGINAL in sport and REPLY in dport
+ f = '%s:%s' % (src[ORIGINAL], sport[ORIGINAL]) if v else src[ORIGINAL]
+ t = '%s:%s' % (dst[REPLY], dport[REPLY]) if v else dst[REPLY]
+ else:
+ v = ORIGINAL in dport and REPLY in sport
+ f = '%s:%s' % (dst[ORIGINAL], dport[ORIGINAL]) if v else dst[ORIGINAL]
+ t = '%s:%s' % (src[REPLY], sport[REPLY]) if v else src[REPLY]
+
+ # Thomas: I do not believe proto should be an option
+ p = proto.get('original', '')
+ if protocol and p != protocol:
+ continue
+
+ if verbose:
+ msg = verbose_format % (in_src, in_dst, out_dst, out_src)
+ p = f'{p}: ' if p else ''
+ msg += f'\n {p}{f} ==> {t}'
+ msg += f' timeout: {timeout}' if timeout else ''
+ msg += f' use: {use} ' if use else ''
+ msg += f' type: {rule_type}' if rule_type else ''
+ print(msg)
+ else:
+ print(normal_format % (f, t, p, timeout, rule_type if rule_type else ''))
+
+ if stats:
+ for direction in ('original', 'reply'):
+ if direction in packet_count:
+ print(' %-8s: packets %s, bytes %s' % direction, packet_count[direction], byte_count[direction])
+
+
+def main():
+ parser = argparse.ArgumentParser(description=sys.modules[__name__].__doc__)
+ parser.add_argument('--verbose', help='provide more details about the flows', action='store_true')
+ parser.add_argument('--proto', help='filter by protocol', default='', type=str)
+ parser.add_argument('--file', help='read the conntrack xml from a file', type=str)
+ parser.add_argument('--stats', help='add usage statistics', action='store_true')
+ parser.add_argument('--type', help='NAT type (source, destination)', required=True, type=str)
+ parser.add_argument('--ipaddr', help='source ip address to filter on', type=ipaddress.ip_address)
+ parser.add_argument('--pipe', help='read conntrack xml data from stdin', action='store_true')
+
+ arg = parser.parse_args()
+
+ if arg.type not in ('source', 'destination'):
+ sys.exit('Unknown NAT type!')
+
+ if arg.pipe:
+ process(pipe(), arg.stats, arg.proto, arg.pipe, arg.verbose, arg.type)
+ elif arg.file:
+ process(content(arg.file), arg.stats, arg.proto, arg.pipe, arg.verbose, arg.type)
+ else:
+ try:
+ process(run(command(arg.type, arg.proto, arg.ipaddr)), arg.stats, arg.proto, arg.pipe, arg.verbose, arg.type)
+ except:
+ pass
+
+if __name__ == '__main__':
+ main()
diff --git a/src/op_mode/show_nat_rules.py b/src/op_mode/show_nat_rules.py
new file mode 100755
index 000000000..a98fbef8c
--- /dev/null
+++ b/src/op_mode/show_nat_rules.py
@@ -0,0 +1,75 @@
+#!/usr/bin/env python3
+#
+# Copyright (C) 2021 VyOS maintainers and contributors
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 or later as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program. If not, see <http://www.gnu.org/licenses/>.
+
+import jmespath
+import json
+
+from argparse import ArgumentParser
+from jinja2 import Template
+from sys import exit
+from vyos.util import cmd
+from vyos.util import dict_search
+
+parser = ArgumentParser()
+group = parser.add_mutually_exclusive_group()
+group.add_argument("--source", help="Show statistics for configured source NAT rules", action="store_true")
+group.add_argument("--destination", help="Show statistics for configured destination NAT rules", action="store_true")
+args = parser.parse_args()
+
+if args.source or args.destination:
+ tmp = cmd('sudo nft -j list table ip nat')
+ tmp = json.loads(tmp)
+
+ format_nat66_rule = '{0: <10} {1: <50} {2: <50} {3: <10}'
+ print(format_nat66_rule.format("Rule", "Source" if args.source else "Destination", "Translation", "Outbound Interface" if args.source else "Inbound Interface"))
+ print(format_nat66_rule.format("----", "------" if args.source else "-----------", "-----------", "------------------" if args.source else "-----------------"))
+
+ data_json = jmespath.search('nftables[?rule].rule[?chain]', tmp)
+ for idx in range(0, len(data_json)):
+ data = data_json[idx]
+ comment = data['comment']
+ rule = int(''.join(list(filter(str.isdigit, comment))))
+ chain = data['chain']
+ if not (args.source and chain == 'POSTROUTING') or (not args.source and chain == 'PREROUTING'):
+ continue
+ interface = dict_search('match.right', data['expr'][0])
+ srcdest = dict_search('match.right.prefix.addr', data['expr'][1])
+ if srcdest:
+ addr_tmp = dict_search('match.right.prefix.len', data['expr'][1])
+ if addr_tmp:
+ srcdest = srcdest + '/' + str(addr_tmp)
+ else:
+ srcdest = dict_search('match.right', data['expr'][1])
+ tran_addr = dict_search('snat.addr.prefix.addr' if args.source else 'dnat.addr.prefix.addr', data['expr'][3])
+ if tran_addr:
+ addr_tmp = dict_search('snat.addr.prefix.len' if args.source else 'dnat.addr.prefix.len', data['expr'][3])
+ if addr_tmp:
+ srcdest = srcdest + '/' + str(addr_tmp)
+ else:
+ if 'masquerade' in data['expr'][3]:
+ tran_addr = 'masquerade'
+ elif 'log' in data['expr'][3]:
+ continue
+ else:
+ tran_addr = dict_search('snat.addr' if args.source else 'dnat.addr', data['expr'][3])
+
+ print(format_nat66_rule.format(rule, srcdest, tran_addr, interface))
+
+ exit(0)
+else:
+ parser.print_help()
+ exit(1)
+
diff --git a/src/op_mode/show_nat_statistics.py b/src/op_mode/show_nat_statistics.py
index 482993d06..c568c8305 100755
--- a/src/op_mode/show_nat_statistics.py
+++ b/src/op_mode/show_nat_statistics.py
@@ -44,7 +44,7 @@ group.add_argument("--destination", help="Show statistics for configured destina
args = parser.parse_args()
if args.source or args.destination:
- tmp = cmd('sudo nft -j list table nat')
+ tmp = cmd('sudo nft -j list table ip nat')
tmp = json.loads(tmp)
source = r"nftables[?rule.chain=='POSTROUTING'].rule.{chain: chain, handle: handle, comment: comment, counter: expr[].counter | [0], interface: expr[].match.right | [0] }"
diff --git a/src/op_mode/show_ntp.sh b/src/op_mode/show_ntp.sh
new file mode 100755
index 000000000..e9dd6c5c9
--- /dev/null
+++ b/src/op_mode/show_ntp.sh
@@ -0,0 +1,39 @@
+#!/bin/sh
+
+basic=0
+info=0
+
+while [[ "$#" -gt 0 ]]; do
+ case $1 in
+ --info) info=1 ;;
+ --basic) basic=1 ;;
+ --server) server=$2; shift ;;
+ *) echo "Unknown parameter passed: $1" ;;
+ esac
+ shift
+done
+
+if ! ps -C ntpd &>/dev/null; then
+ echo NTP daemon disabled
+ exit 1
+fi
+
+PID=$(pgrep ntpd)
+VRF_NAME=$(ip vrf identify ${PID})
+
+if [ ! -z ${VRF_NAME} ]; then
+ VRF_CMD="sudo ip vrf exec ${VRF_NAME}"
+fi
+
+if [ $basic -eq 1 ]; then
+ $VRF_CMD ntpq -n -c peers
+elif [ $info -eq 1 ]; then
+ echo "=== sysingo ==="
+ $VRF_CMD ntpq -n -c sysinfo
+ echo
+ echo "=== kerninfo ==="
+ $VRF_CMD ntpq -n -c kerninfo
+elif [ ! -z $server ]; then
+ $VRF_CMD /usr/sbin/ntpdate -q $server
+fi
+
diff --git a/src/services/vyos-configd b/src/services/vyos-configd
index 1e60e53df..6f770b696 100755
--- a/src/services/vyos-configd
+++ b/src/services/vyos-configd
@@ -25,7 +25,7 @@ import logging
import signal
import importlib.util
import zmq
-from contextlib import redirect_stdout, redirect_stderr
+from contextlib import contextmanager
from vyos.defaults import directories
from vyos.configsource import ConfigSourceString, ConfigSourceError
@@ -108,20 +108,42 @@ conf_mode_scripts = dict(zip(imports, modules))
exclude_set = {key_name_from_file_name(f) for f in filenames if f not in include}
include_set = {key_name_from_file_name(f) for f in filenames if f in include}
+@contextmanager
+def stdout_redirected(filename, mode):
+ saved_stdout_fd = None
+ destination_file = None
+ try:
+ sys.stdout.flush()
+ saved_stdout_fd = os.dup(sys.stdout.fileno())
+ destination_file = open(filename, mode)
+ os.dup2(destination_file.fileno(), sys.stdout.fileno())
+ yield
+ finally:
+ if saved_stdout_fd is not None:
+ os.dup2(saved_stdout_fd, sys.stdout.fileno())
+ os.close(saved_stdout_fd)
+ if destination_file is not None:
+ destination_file.close()
+
+def explicit_print(path, mode, msg):
+ try:
+ with open(path, mode) as f:
+ f.write(f"\n{msg}\n\n")
+ except OSError:
+ logger.critical("error explicit_print")
-def run_script(script, config) -> int:
+def run_script(script, config, args) -> int:
+ if args:
+ script.argv = args
config.set_level([])
try:
- with open(session_out, session_mode) as f, redirect_stdout(f):
- with redirect_stderr(f):
- c = script.get_config(config)
- script.verify(c)
- script.generate(c)
- script.apply(c)
+ c = script.get_config(config)
+ script.verify(c)
+ script.generate(c)
+ script.apply(c)
except ConfigError as e:
logger.critical(e)
- with open(session_out, session_mode) as f, redirect_stdout(f):
- print(f"{e}\n")
+ explicit_print(session_out, session_mode, str(e))
return R_ERROR_COMMIT
except Exception as e:
logger.critical(e)
@@ -165,7 +187,7 @@ def initialization(socket):
session_out = None
# if not a 'live' session, for example on boot, write to file
- if not session_out or '/dev/pts' not in session_out:
+ if not session_out or not os.path.isfile('/tmp/vyos-config-status'):
session_out = script_stdout_log
session_mode = 'a'
@@ -186,22 +208,26 @@ def process_node_data(config, data) -> int:
return R_ERROR_DAEMON
script_name = None
+ args = None
- res = re.match(r'^.+\/([^/].+).py(VYOS_TAGNODE_VALUE=.+)?', data)
+ res = re.match(r'^(VYOS_TAGNODE_VALUE=[^/]+)?.*\/([^/]+).py(.*)', data)
if res.group(1):
- script_name = res.group(1)
- if res.group(2):
- env = res.group(2).split('=')
+ env = res.group(1).split('=')
os.environ[env[0]] = env[1]
-
+ if res.group(2):
+ script_name = res.group(2)
if not script_name:
logger.critical(f"Missing script_name")
return R_ERROR_DAEMON
+ if res.group(3):
+ args = res.group(3).split()
+ args.insert(0, f'{script_name}.py')
- if script_name in exclude_set:
+ if script_name not in include_set:
return R_PASS
- result = run_script(conf_mode_scripts[script_name], config)
+ with stdout_redirected(session_out, session_mode):
+ result = run_script(conf_mode_scripts[script_name], config, args)
return result
diff --git a/src/services/vyos-http-api-server b/src/services/vyos-http-api-server
index 703628558..8069d7146 100755
--- a/src/services/vyos-http-api-server
+++ b/src/services/vyos-http-api-server
@@ -1,6 +1,6 @@
-#!/usr/bin/env python3
+#!/usr/share/vyos-http-api-tools/bin/python3
#
-# Copyright (C) 2019 VyOS maintainers and contributors
+# Copyright (C) 2019-2021 VyOS maintainers and contributors
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 or later as
@@ -19,25 +19,37 @@
import os
import sys
import grp
+import copy
import json
+import logging
import traceback
import threading
-import signal
+from typing import List, Union, Callable, Dict
-import vyos.config
-
-from flask import Flask, request
-from waitress import serve
+import uvicorn
+from fastapi import FastAPI, Depends, Request, Response, HTTPException
+from fastapi.responses import HTMLResponse
+from fastapi.exceptions import RequestValidationError
+from fastapi.routing import APIRoute
+from pydantic import BaseModel, StrictStr, validator
-from functools import wraps
+import vyos.config
from vyos.configsession import ConfigSession, ConfigSessionError
-
DEFAULT_CONFIG_FILE = '/etc/vyos/http-api.conf'
CFG_GROUP = 'vyattacfg'
-app = Flask(__name__)
+debug = True
+
+logger = logging.getLogger(__name__)
+logs_handler = logging.StreamHandler()
+logger.addHandler(logs_handler)
+
+if debug:
+ logger.setLevel(logging.DEBUG)
+else:
+ logger.setLevel(logging.INFO)
# Giant lock!
lock = threading.Lock()
@@ -56,55 +68,310 @@ def check_auth(key_list, key):
def error(code, msg):
resp = {"success": False, "error": msg, "data": None}
- return json.dumps(resp), code
+ resp = json.dumps(resp)
+ return HTMLResponse(resp, status_code=code)
def success(data):
resp = {"success": True, "data": data, "error": None}
- return json.dumps(resp)
-
-def get_command(f):
- @wraps(f)
- def decorated_function(*args, **kwargs):
- cmd = request.form.get("data")
- if not cmd:
- return error(400, "Non-empty data field is required")
- try:
- cmd = json.loads(cmd)
- except Exception as e:
- return error(400, "Failed to parse JSON: {0}".format(e))
- return f(cmd, *args, **kwargs)
-
- return decorated_function
-
-def auth_required(f):
- @wraps(f)
- def decorated_function(*args, **kwargs):
- key = request.form.get("key")
- api_keys = app.config['vyos_keys']
- id = check_auth(api_keys, key)
- if not id:
- return error(401, "Valid API key is required")
- return f(*args, **kwargs)
-
- return decorated_function
-
-@app.route('/configure', methods=['POST'])
-@get_command
-@auth_required
-def configure_op(commands):
- session = app.config['vyos_session']
+ resp = json.dumps(resp)
+ return HTMLResponse(resp)
+
+# Pydantic models for validation
+# Pydantic will cast when possible, so use StrictStr
+# validators added as needed for additional constraints
+# schema_extra adds anotations to OpenAPI, to add examples
+
+class ApiModel(BaseModel):
+ key: StrictStr
+
+class BaseConfigureModel(BaseModel):
+ op: StrictStr
+ path: List[StrictStr]
+ value: StrictStr = None
+
+ @validator("path", pre=True, always=True)
+ def check_non_empty(cls, path):
+ assert len(path) > 0
+ return path
+
+class ConfigureModel(ApiModel):
+ op: StrictStr
+ path: List[StrictStr]
+ value: StrictStr = None
+
+ @validator("path", pre=True, always=True)
+ def check_non_empty(cls, path):
+ assert len(path) > 0
+ return path
+
+ class Config:
+ schema_extra = {
+ "example": {
+ "key": "id_key",
+ "op": "set | delete | comment",
+ "path": ['config', 'mode', 'path'],
+ }
+ }
+
+class ConfigureListModel(ApiModel):
+ commands: List[BaseConfigureModel]
+
+ class Config:
+ schema_extra = {
+ "example": {
+ "key": "id_key",
+ "commands": "list of commands",
+ }
+ }
+
+class RetrieveModel(ApiModel):
+ op: StrictStr
+ path: List[StrictStr]
+ configFormat: StrictStr = None
+
+ class Config:
+ schema_extra = {
+ "example": {
+ "key": "id_key",
+ "op": "returnValue | returnValues | exists | showConfig",
+ "path": ['config', 'mode', 'path'],
+ "configFormat": "json (default) | json_ast | raw",
+
+ }
+ }
+
+class ConfigFileModel(ApiModel):
+ op: StrictStr
+ file: StrictStr = None
+
+ class Config:
+ schema_extra = {
+ "example": {
+ "key": "id_key",
+ "op": "save | load",
+ "file": "filename",
+ }
+ }
+
+class ImageModel(ApiModel):
+ op: StrictStr
+ url: StrictStr = None
+ name: StrictStr = None
+
+ class Config:
+ schema_extra = {
+ "example": {
+ "key": "id_key",
+ "op": "add | delete",
+ "url": "imagelocation",
+ "name": "imagename",
+ }
+ }
+
+class GenerateModel(ApiModel):
+ op: StrictStr
+ path: List[StrictStr]
+
+ class Config:
+ schema_extra = {
+ "example": {
+ "key": "id_key",
+ "op": "generate",
+ "path": ["op", "mode", "path"],
+ }
+ }
+
+class ShowModel(ApiModel):
+ op: StrictStr
+ path: List[StrictStr]
+
+ class Config:
+ schema_extra = {
+ "example": {
+ "key": "id_key",
+ "op": "show",
+ "path": ["op", "mode", "path"],
+ }
+ }
+
+class Success(BaseModel):
+ success: bool
+ data: Union[str, bool, Dict]
+ error: str
+
+class Error(BaseModel):
+ success: bool = False
+ data: Union[str, bool, Dict]
+ error: str
+
+responses = {
+ 200: {'model': Success},
+ 400: {'model': Error},
+ 422: {'model': Error, 'description': 'Validation Error'},
+ 500: {'model': Error}
+}
+
+def auth_required(data: ApiModel):
+ key = data.key
+ api_keys = app.state.vyos_keys
+ id = check_auth(api_keys, key)
+ if not id:
+ raise HTTPException(status_code=401, detail="Valid API key is required")
+ app.state.vyos_id = id
+
+# override Request and APIRoute classes in order to convert form request to json;
+# do all explicit validation here, for backwards compatability of error messages;
+# the explicit validation may be dropped, if desired, in favor of native
+# validation by FastAPI/Pydantic, as is used for application/json requests
+class MultipartRequest(Request):
+ ERR_MISSING_KEY = False
+ ERR_MISSING_DATA = False
+ ERR_NOT_JSON = False
+ ERR_NOT_DICT = False
+ ERR_NO_OP = False
+ ERR_NO_PATH = False
+ ERR_EMPTY_PATH = False
+ ERR_PATH_NOT_LIST = False
+ ERR_VALUE_NOT_STRING = False
+ ERR_PATH_NOT_LIST_OF_STR = False
+ offending_command = {}
+ exception = None
+ async def body(self) -> bytes:
+ if not hasattr(self, "_body"):
+ forms = {}
+ merge = {}
+ body = await super().body()
+ self._body = body
+
+ form_data = await self.form()
+ if form_data:
+ logger.debug("processing form data")
+ for k, v in form_data.multi_items():
+ forms[k] = v
+
+ if 'data' not in forms:
+ self.ERR_MISSING_DATA = True
+ else:
+ try:
+ tmp = json.loads(forms['data'])
+ except json.JSONDecodeError as e:
+ self.ERR_NOT_JSON = True
+ self.exception = e
+ tmp = {}
+ if isinstance(tmp, list):
+ merge['commands'] = tmp
+ else:
+ merge = tmp
+
+ if 'commands' in merge:
+ cmds = merge['commands']
+ else:
+ cmds = copy.deepcopy(merge)
+ cmds = [cmds]
+
+ for c in cmds:
+ if not isinstance(c, dict):
+ self.ERR_NOT_DICT = True
+ self.offending_command = c
+ elif 'op' not in c:
+ self.ERR_NO_OP = True
+ self.offending_command = c
+ elif 'path' not in c:
+ self.ERR_NO_PATH = True
+ self.offending_command = c
+ elif not c['path']:
+ self.ERR_EMPTY_PATH = True
+ self.offending_command = c
+ elif not isinstance(c['path'], list):
+ self.ERR_PATH_NOT_LIST = True
+ self.offending_command = c
+ elif not all(isinstance(el, str) for el in c['path']):
+ self.ERR_PATH_NOT_LIST_OF_STR = True
+ self.offending_command = c
+ elif 'value' in c and not isinstance(c['value'], str):
+ self.ERR_VALUE_NOT_STRING = True
+ self.offending_command = c
+
+ if 'key' not in forms and 'key' not in merge:
+ self.ERR_MISSING_KEY = True
+ if 'key' in forms and 'key' not in merge:
+ merge['key'] = forms['key']
+
+ new_body = json.dumps(merge)
+ new_body = new_body.encode()
+ self._body = new_body
+
+ return self._body
+
+class MultipartRoute(APIRoute):
+ def get_route_handler(self) -> Callable:
+ original_route_handler = super().get_route_handler()
+
+ async def custom_route_handler(request: Request) -> Response:
+ request = MultipartRequest(request.scope, request.receive)
+ endpoint = request.url.path
+ try:
+ response: Response = await original_route_handler(request)
+ except HTTPException as e:
+ return error(e.status_code, e.detail)
+ except Exception as e:
+ if request.ERR_MISSING_KEY:
+ return error(422, "Valid API key is required")
+ if request.ERR_MISSING_DATA:
+ return error(422, "Non-empty data field is required")
+ if request.ERR_NOT_JSON:
+ return error(400, "Failed to parse JSON: {0}".format(request.exception))
+ if endpoint == '/configure':
+ if request.ERR_NOT_DICT:
+ return error(400, "Malformed command \"{0}\": any command must be a dict".format(json.dumps(request.offending_command)))
+ if request.ERR_NO_OP:
+ return error(400, "Malformed command \"{0}\": missing \"op\" field".format(json.dumps(request.offending_command)))
+ if request.ERR_NO_PATH:
+ return error(400, "Malformed command \"{0}\": missing \"path\" field".format(json.dumps(request.offending_command)))
+ if request.ERR_EMPTY_PATH:
+ return error(400, "Malformed command \"{0}\": empty path".format(json.dumps(request.offending_command)))
+ if request.ERR_PATH_NOT_LIST:
+ return error(400, "Malformed command \"{0}\": \"path\" field must be a list".format(json.dumps(request.offending_command)))
+ if request.ERR_VALUE_NOT_STRING:
+ return error(400, "Malformed command \"{0}\": \"value\" field must be a string".format(json.dumps(request.offending_command)))
+ if request.ERR_PATH_NOT_LIST_OF_STR:
+ return error(400, "Malformed command \"{0}\": \"path\" field must be a list of strings".format(json.dumps(request.offending_command)))
+ if endpoint in ('/retrieve','/generate','/show'):
+ if request.ERR_NO_OP or request.ERR_NO_PATH:
+ return error(400, "Missing required field. \"op\" and \"path\" fields are required")
+ if endpoint in ('/config-file', '/image'):
+ if request.ERR_NO_OP:
+ return error(400, "Missing required field \"op\"")
+
+ raise e
+
+ return response
+
+ return custom_route_handler
+
+app = FastAPI(debug=True,
+ title="VyOS API",
+ version="0.1.0",
+ responses={**responses},
+ dependencies=[Depends(auth_required)])
+
+app.router.route_class = MultipartRoute
+
+@app.exception_handler(RequestValidationError)
+async def validation_exception_handler(request, exc):
+ return error(400, str(exc.errors()[0]))
+
+@app.post('/configure')
+def configure_op(data: Union[ConfigureModel, ConfigureListModel]):
+ session = app.state.vyos_session
env = session.get_session_env()
config = vyos.config.Config(session_env=env)
- strict_field = request.form.get("strict")
- if strict_field == "true":
- strict = True
- else:
- strict = False
-
# Allow users to pass just one command
- if not isinstance(commands, list):
- commands = [commands]
+ if not isinstance(data, ConfigureListModel):
+ data = [data]
+ else:
+ data = data.commands
# We don't want multiple people/apps to be able to commit at once,
# or modify the shared session while someone else is doing the same,
@@ -114,53 +381,25 @@ def configure_op(commands):
status = 200
error_msg = None
try:
- for c in commands:
- # What we've got may not even be a dict
- if not isinstance(c, dict):
- raise ConfigSessionError("Malformed command \"{0}\": any command must be a dict".format(json.dumps(c)))
-
- # Missing op or path is a show stopper
- if not ('op' in c):
- raise ConfigSessionError("Malformed command \"{0}\": missing \"op\" field".format(json.dumps(c)))
- if not ('path' in c):
- raise ConfigSessionError("Malformed command \"{0}\": missing \"path\" field".format(json.dumps(c)))
-
- # Missing value is fine, substitute for empty string
- if 'value' in c:
- value = c['value']
- else:
- value = ""
-
- op = c['op']
- path = c['path']
-
- if not path:
- raise ConfigSessionError("Malformed command \"{0}\": empty path".format(json.dumps(c)))
-
- # Type checking
- if not isinstance(path, list):
- raise ConfigSessionError("Malformed command \"{0}\": \"path\" field must be a list".format(json.dumps(c)))
+ for c in data:
+ op = c.op
+ path = c.path
- if not isinstance(value, str):
- raise ConfigSessionError("Malformed command \"{0}\": \"value\" field must be a string".format(json.dumps(c)))
-
- # Account for the case when value field is present and set to null
- if not value:
+ if c.value:
+ value = c.value
+ else:
value = ""
- # For vyos.configsessios calls that have no separate value arguments,
+ # For vyos.configsession calls that have no separate value arguments,
# and for type checking too
- try:
- cfg_path = " ".join(path + [value]).strip()
- except TypeError:
- raise ConfigSessionError("Malformed command \"{0}\": \"path\" field must be a list of strings".format(json.dumps(c)))
+ cfg_path = " ".join(path + [value]).strip()
if op == 'set':
# XXX: it would be nice to do a strict check for "path already exists",
# but there's probably no way to do that
session.set(path, value=value)
elif op == 'delete':
- if strict and not config.exists(cfg_path):
+ if app.state.vyos_strict and not config.exists(cfg_path):
raise ConfigSessionError("Cannot delete [{0}]: path/value does not exist".format(cfg_path))
session.delete(path, value=value)
elif op == 'comment':
@@ -169,16 +408,16 @@ def configure_op(commands):
raise ConfigSessionError("\"{0}\" is not a valid operation".format(op))
# end for
session.commit()
- print("Configuration modified via HTTP API using key \"{0}\"".format(id))
+ logger.info(f"Configuration modified via HTTP API using key '{app.state.vyos_id}'")
except ConfigSessionError as e:
session.discard()
status = 400
- if app.config['vyos_debug']:
- print(traceback.format_exc(), file=sys.stderr)
+ if app.state.vyos_debug:
+ logger.critical(f"ConfigSessionError:\n {traceback.format_exc()}")
error_msg = str(e)
except Exception as e:
session.discard()
- print(traceback.format_exc(), file=sys.stderr)
+ logger.critical(traceback.format_exc())
status = 500
# Don't give the details away to the outer world
@@ -188,22 +427,17 @@ def configure_op(commands):
if status != 200:
return error(status, error_msg)
- else:
- return success(None)
-@app.route('/retrieve', methods=['POST'])
-@get_command
-@auth_required
-def retrieve_op(command):
- session = app.config['vyos_session']
+ return success(None)
+
+@app.post("/retrieve")
+def retrieve_op(data: RetrieveModel):
+ session = app.state.vyos_session
env = session.get_session_env()
config = vyos.config.Config(session_env=env)
- try:
- op = command['op']
- path = " ".join(command['path'])
- except KeyError:
- return error(400, "Missing required field. \"op\" and \"path\" fields are required")
+ op = data.op
+ path = " ".join(data.path)
try:
if op == 'returnValue':
@@ -214,10 +448,10 @@ def retrieve_op(command):
res = config.exists(path)
elif op == 'showConfig':
config_format = 'json'
- if 'configFormat' in command:
- config_format = command['configFormat']
+ if data.configFormat:
+ config_format = data.configFormat
- res = session.show_config(path=command['path'])
+ res = session.show_config(path=data.path)
if config_format == 'json':
config_tree = vyos.configtree.ConfigTree(res)
res = json.loads(config_tree.to_json())
@@ -233,33 +467,28 @@ def retrieve_op(command):
except ConfigSessionError as e:
return error(400, str(e))
except Exception as e:
- print(traceback.format_exc(), file=sys.stderr)
+ logger.critical(traceback.format_exc())
return error(500, "An internal error occured. Check the logs for details.")
return success(res)
-@app.route('/config-file', methods=['POST'])
-@get_command
-@auth_required
-def config_file_op(command):
- session = app.config['vyos_session']
+@app.post('/config-file')
+def config_file_op(data: ConfigFileModel):
+ session = app.state.vyos_session
- try:
- op = command['op']
- except KeyError:
- return error(400, "Missing required field \"op\"")
+ op = data.op
try:
if op == 'save':
- try:
- path = command['file']
- except KeyError:
+ if data.file:
+ path = data.file
+ else:
path = '/config/config.boot'
res = session.save_config(path)
elif op == 'load':
- try:
- path = command['file']
- except KeyError:
+ if data.file:
+ path = data.file
+ else:
return error(400, "Missing required field \"file\"")
res = session.migrate_and_load_config(path)
res = session.commit()
@@ -268,33 +497,28 @@ def config_file_op(command):
except ConfigSessionError as e:
return error(400, str(e))
except Exception as e:
- print(traceback.format_exc(), file=sys.stderr)
+ logger.critical(traceback.format_exc())
return error(500, "An internal error occured. Check the logs for details.")
return success(res)
-@app.route('/image', methods=['POST'])
-@get_command
-@auth_required
-def image_op(command):
- session = app.config['vyos_session']
+@app.post('/image')
+def image_op(data: ImageModel):
+ session = app.state.vyos_session
- try:
- op = command['op']
- except KeyError:
- return error(400, "Missing required field \"op\"")
+ op = data.op
try:
if op == 'add':
- try:
- url = command['url']
- except KeyError:
+ if data.url:
+ url = data.url
+ else:
return error(400, "Missing required field \"url\"")
res = session.install_image(url)
elif op == 'delete':
- try:
- name = command['name']
- except KeyError:
+ if data.name:
+ name = data.name
+ else:
return error(400, "Missing required field \"name\"")
res = session.remove_image(name)
else:
@@ -302,26 +526,17 @@ def image_op(command):
except ConfigSessionError as e:
return error(400, str(e))
except Exception as e:
- print(traceback.format_exc(), file=sys.stderr)
+ logger.critical(traceback.format_exc())
return error(500, "An internal error occured. Check the logs for details.")
return success(res)
+@app.post('/generate')
+def generate_op(data: GenerateModel):
+ session = app.state.vyos_session
-@app.route('/generate', methods=['POST'])
-@get_command
-@auth_required
-def generate_op(command):
- session = app.config['vyos_session']
-
- try:
- op = command['op']
- path = command['path']
- except KeyError:
- return error(400, "Missing required field. \"op\" and \"path\" fields are required")
-
- if not isinstance(path, list):
- return error(400, "Malformed command: \"path\" field must be a list of strings")
+ op = data.op
+ path = data.path
try:
if op == 'generate':
@@ -331,25 +546,17 @@ def generate_op(command):
except ConfigSessionError as e:
return error(400, str(e))
except Exception as e:
- print(traceback.format_exc(), file=sys.stderr)
+ logger.critical(traceback.format_exc())
return error(500, "An internal error occured. Check the logs for details.")
return success(res)
-@app.route('/show', methods=['POST'])
-@get_command
-@auth_required
-def show_op(command):
- session = app.config['vyos_session']
+@app.post('/show')
+def show_op(data: ShowModel):
+ session = app.state.vyos_session
- try:
- op = command['op']
- path = command['path']
- except KeyError:
- return error(400, "Missing required field. \"op\" and \"path\" fields are required")
-
- if not isinstance(path, list):
- return error(400, "Malformed command: \"path\" field must be a list of strings")
+ op = data.op
+ path = data.path
try:
if op == 'show':
@@ -359,14 +566,11 @@ def show_op(command):
except ConfigSessionError as e:
return error(400, str(e))
except Exception as e:
- print(traceback.format_exc(), file=sys.stderr)
+ logger.critical(traceback.format_exc())
return error(500, "An internal error occured. Check the logs for details.")
return success(res)
-def shutdown():
- raise KeyboardInterrupt
-
if __name__ == '__main__':
# systemd's user and group options don't work, do it by hand here,
# else no one else will be able to commit
@@ -380,21 +584,20 @@ if __name__ == '__main__':
try:
server_config = load_server_config()
except Exception as e:
- print("Failed to load the HTTP API server config: {0}".format(e))
+ logger.critical("Failed to load the HTTP API server config: {0}".format(e))
session = ConfigSession(os.getpid())
- app.config['vyos_session'] = session
- app.config['vyos_keys'] = server_config['api_keys']
- app.config['vyos_debug'] = server_config['debug']
-
- def sig_handler(signum, frame):
- shutdown()
+ app.state.vyos_session = session
+ app.state.vyos_keys = server_config['api_keys']
- signal.signal(signal.SIGTERM, sig_handler)
+ app.state.vyos_debug = True if server_config['debug'] == 'true' else False
+ app.state.vyos_strict = True if server_config['strict'] == 'true' else False
try:
- serve(app, host=server_config["listen_address"],
- port=server_config["port"])
+ uvicorn.run(app, host=server_config["listen_address"],
+ port=int(server_config["port"]),
+ proxy_headers=True)
except OSError as e:
- print(f"OSError {e}")
+ logger.critical(f"OSError {e}")
+ sys.exit(1)
diff --git a/src/shim/vyshim.c b/src/shim/vyshim.c
index 196e3221e..cae8b6152 100644
--- a/src/shim/vyshim.c
+++ b/src/shim/vyshim.c
@@ -75,28 +75,32 @@ int main(int argc, char* argv[])
void *context = zmq_ctx_new();
void *requester = zmq_socket(context, ZMQ_REQ);
+ int ex_index;
int init_timeout = 0;
debug_print("Connecting to vyos-configd ...\n");
zmq_connect(requester, SOCKET_PATH);
+ for (int i = 1; i < argc ; i++) {
+ strncat(&string_node_data[0], argv[i], 127);
+ }
+
+ debug_print("data to send: %s\n", string_node_data);
+
+ char *test = strstr(string_node_data, "VYOS_TAGNODE_VALUE");
+ ex_index = test ? 2 : 1;
+
if (access(COMMIT_MARKER, F_OK) != -1) {
init_timeout = initialization(requester);
if (!init_timeout) remove(COMMIT_MARKER);
}
- int end = argc > 3 ? 2 : argc - 1;
-
// if initial communication failed, pass through execution of script
if (init_timeout) {
- int ret = pass_through(argv, end);
+ int ret = pass_through(argv, ex_index);
return ret;
}
- for (int i = end; i > 0 ; i--) {
- strncat(&string_node_data[0], argv[i], 127);
- }
-
char error_code[1];
debug_print("Sending node data ...\n");
char *string_node_data_msg = mkjson(MKJSON_OBJ, 2,
@@ -116,13 +120,13 @@ int main(int argc, char* argv[])
if (err & PASS) {
debug_print("Received PASS\n");
- int ret = pass_through(argv, end);
+ int ret = pass_through(argv, ex_index);
return ret;
}
if (err & ERROR_DAEMON) {
debug_print("Received ERROR_DAEMON\n");
- int ret = pass_through(argv, end);
+ int ret = pass_through(argv, ex_index);
return ret;
}
@@ -232,14 +236,14 @@ int initialization(void* Requester)
return 0;
}
-int pass_through(char **argv, int end)
+int pass_through(char **argv, int ex_index)
{
- char *newargv[] = { NULL, NULL };
+ char **newargv = NULL;
pid_t child_pid;
- newargv[0] = argv[end];
- if (end > 1) {
- putenv(argv[end - 1]);
+ newargv = &argv[ex_index];
+ if (ex_index > 1) {
+ putenv(argv[ex_index - 1]);
}
debug_print("pass-through invoked\n");
@@ -248,9 +252,9 @@ int pass_through(char **argv, int end)
debug_print("fork() failed\n");
return -1;
} else if (child_pid == 0) {
- if (-1 == execv(argv[end], newargv)) {
+ if (-1 == execv(argv[ex_index], newargv)) {
debug_print("pass_through execve failed %s: %s\n",
- argv[end], strerror(errno));
+ argv[ex_index], strerror(errno));
return -1;
}
} else if (child_pid > 0) {
diff --git a/src/systemd/vyos-http-api.service b/src/systemd/vyos-http-api.service
index 4fa68b4ff..ba5df5984 100644
--- a/src/systemd/vyos-http-api.service
+++ b/src/systemd/vyos-http-api.service
@@ -5,9 +5,8 @@ Requires=vyos-router.service
[Service]
ExecStartPre=/usr/libexec/vyos/init/vyos-config
-ExecStart=/usr/bin/python3 -u /usr/libexec/vyos/services/vyos-http-api-server
+ExecStart=/usr/libexec/vyos/services/vyos-http-api-server
Type=idle
-KillMode=process
SyslogIdentifier=vyos-http-api
SyslogFacility=daemon
diff --git a/src/tests/test_dict_search.py b/src/tests/test_dict_search.py
index 6a0fc74ad..991722f0f 100644
--- a/src/tests/test_dict_search.py
+++ b/src/tests/test_dict_search.py
@@ -20,6 +20,7 @@ from vyos.util import dict_search
data = {
'string': 'fooo',
'nested': {'string': 'bar', 'empty': '', 'list': ['foo', 'bar']},
+ 'non': {},
'list': ['bar', 'baz'],
'dict': {'key_1': {}, 'key_2': 'vyos'}
}
@@ -30,7 +31,8 @@ class TestDictSearch(TestCase):
def test_non_existing_keys(self):
# TestDictSearch: Return False when querying for non-existent key
- self.assertFalse(dict_search('non_existing', data))
+ self.assertEqual(dict_search('non_existing', data), None)
+ self.assertEqual(dict_search('non.existing.fancy.key', data), None)
def test_string(self):
# TestDictSearch: Return value when querying string
@@ -50,8 +52,14 @@ class TestDictSearch(TestCase):
def test_nested_dict_key_empty(self):
# TestDictSearch: Return False when querying for a nested string whose last key is empty
+ self.assertEqual(dict_search('nested.empty', data), '')
self.assertFalse(dict_search('nested.empty', data))
def test_nested_list(self):
# TestDictSearch: Return list items when querying nested list
self.assertEqual(dict_search('nested.list', data), data['nested']['list'])
+
+ def test_invalid_input(self):
+ # TestDictSearch: Return list items when querying nested list
+ self.assertEqual(dict_search('nested.list', None), None)
+ self.assertEqual(dict_search(None, data), None)
diff --git a/src/validators/interface-name b/src/validators/interface-name
index 72e9fd54a..5bac671b1 100755
--- a/src/validators/interface-name
+++ b/src/validators/interface-name
@@ -14,14 +14,21 @@
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
+import os
import re
-import sys
+
+from sys import argv
+from sys import exit
pattern = '^(bond|br|dum|en|ersp|eth|gnv|lan|l2tp|l2tpeth|macsec|peth|ppp|pppoe|pptp|sstp|tun|vti|vtun|vxlan|wg|wlan|wlm)[0-9]+(.\d+)?|lo$'
if __name__ == '__main__':
- if len(sys.argv) != 2:
- sys.exit(1)
- if not re.match(pattern, sys.argv[1]):
- sys.exit(1)
- sys.exit(0)
+ if len(argv) != 2:
+ exit(1)
+ interface = argv[1]
+
+ if re.match(pattern, interface):
+ exit(0)
+ if os.path.exists(f'/sys/class/net/{interface}'):
+ exit(0)
+ exit(1)
diff --git a/src/validators/ipv6-eui64-prefix b/src/validators/ipv6-eui64-prefix
new file mode 100755
index 000000000..d7f262633
--- /dev/null
+++ b/src/validators/ipv6-eui64-prefix
@@ -0,0 +1,16 @@
+#!/usr/bin/env python3
+
+# Validator used to check if given IPv6 prefix is of size /64 required by EUI64
+
+from sys import argv
+from sys import exit
+
+if __name__ == '__main__':
+ if len(argv) != 2:
+ exit(1)
+
+ prefix = argv[1]
+ if prefix.split('/')[1] == '64':
+ exit(0)
+
+ exit(1)