1
# Copyright 2011 Cisco Systems, Inc. All rights reserved.
3
# Licensed under the Apache License, Version 2.0 (the "License"); you may
4
# not use this file except in compliance with the License. You may obtain
5
# a copy of the License at
7
# http://www.apache.org/licenses/LICENSE-2.0
9
# Unless required by applicable law or agreed to in writing, software
10
# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
11
# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
12
# License for the specific language governing permissions and limitations
15
# @author: Edgar Magana, Cisco Systems, Inc.
16
# @author: Arvind Somya (asomya@cisco.com) Cisco Systems, Inc.
19
Nexus-OS XML-based configuration snippets
23
# The following are standard strings, messages used to communicate with Nexus,
24
EXEC_CONF_SNIPPET = """
25
<config xmlns:xc="urn:ietf:params:xml:ns:netconf:base:1.0">
27
<__XML__MODE__exec_configure>%s
28
</__XML__MODE__exec_configure>
33
CMD_VLAN_CONF_SNIPPET = """
35
<vlan-id-create-delete>
36
<__XML__PARAM_value>%s</__XML__PARAM_value>
39
<vlan-name>%s</vlan-name>
42
</vlan-id-create-delete>
46
CMD_VLAN_ACTIVE_SNIPPET = """
48
<vlan-id-create-delete>
49
<__XML__PARAM_value>%s</__XML__PARAM_value>
52
<vstate>active</vstate>
55
</vlan-id-create-delete>
59
CMD_VLAN_NO_SHUTDOWN_SNIPPET = """
61
<vlan-id-create-delete>
62
<__XML__PARAM_value>%s</__XML__PARAM_value>
68
</vlan-id-create-delete>
72
CMD_NO_VLAN_CONF_SNIPPET = """
75
<vlan-id-create-delete>
76
<__XML__PARAM_value>%s</__XML__PARAM_value>
77
</vlan-id-create-delete>
82
CMD_INT_VLAN_HEADER = """
85
<interface>%s</interface>
86
<__XML__MODE_if-ethernet-switch>
93
<vlan_id>%s</vlan_id>"""
97
</add>""" % CMD_VLAN_ID
99
CMD_INT_VLAN_TRAILER = """
104
</__XML__MODE_if-ethernet-switch>
109
CMD_INT_VLAN_SNIPPET = (CMD_INT_VLAN_HEADER +
111
CMD_INT_VLAN_TRAILER)
113
CMD_INT_VLAN_ADD_SNIPPET = (CMD_INT_VLAN_HEADER +
115
CMD_INT_VLAN_TRAILER)
117
CMD_NO_VLAN_INT_SNIPPET = """
120
<interface>%s</interface>
121
<__XML__MODE_if-ethernet-switch>
122
<switchport></switchport>
134
</__XML__MODE_if-ethernet-switch>
139
FILTER_SHOW_VLAN_BRIEF_SNIPPET = """
140
<show xmlns="http://www.cisco.com/nxos:1.0:vlan_mgr_cli">
147
CMD_VLAN_SVI_SNIPPET = """
157
<address>%s</address>
165
CMD_NO_VLAN_SVI_SNIPPET = """