~niedbalski/ubuntu/vivid/neutron/fixes-1447803

« back to all changes in this revision

Viewing changes to neutron/plugins/cisco/nexus/cisco_nexus_snippets.py

  • Committer: Package Import Robot
  • Author(s): James Page
  • Date: 2014-10-03 18:45:23 UTC
  • mfrom: (1.1.15)
  • Revision ID: package-import@ubuntu.com-20141003184523-4mt6dy1q3j8n30c9
Tags: 1:2014.2~rc1-0ubuntu1
* New upstream release candidate:
  - d/p/*: Refreshed.
  - d/control: Add python-requests-mock to BD's.
  - d/control: Align versioned requirements with upstream.
* Transition linuxbridge and openvswitch plugin users to modular
  layer 2 plugin (LP: #1323729):
  - d/control: Mark removed plugin packages as transitional, depend
    on neutron-plugin-ml2, mark oldlibs/extra.
  - d/neutron-plugin-{linuxbridge,openvswitch}.install: Drop.
  - d/control: Depend on neutron-plugin-ml2 for linuxbridge
    agent package.
  - d/neutron-plugin-linuxbridge-agent.upstart: Use ml2 plugin
    configuration files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright 2011 Cisco Systems, Inc.  All rights reserved.
2
 
#
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
6
 
#
7
 
#         http://www.apache.org/licenses/LICENSE-2.0
8
 
#
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
13
 
#    under the License.
14
 
#
15
 
# @author: Edgar Magana, Cisco Systems, Inc.
16
 
# @author: Arvind Somya (asomya@cisco.com) Cisco Systems, Inc.
17
 
 
18
 
"""
19
 
Nexus-OS XML-based configuration snippets
20
 
"""
21
 
 
22
 
 
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">
26
 
        <configure>
27
 
          <__XML__MODE__exec_configure>%s
28
 
          </__XML__MODE__exec_configure>
29
 
        </configure>
30
 
      </config>
31
 
"""
32
 
 
33
 
CMD_VLAN_CONF_SNIPPET = """
34
 
            <vlan>
35
 
              <vlan-id-create-delete>
36
 
                <__XML__PARAM_value>%s</__XML__PARAM_value>
37
 
                <__XML__MODE_vlan>
38
 
                  <name>
39
 
                    <vlan-name>%s</vlan-name>
40
 
                  </name>
41
 
                </__XML__MODE_vlan>
42
 
              </vlan-id-create-delete>
43
 
            </vlan>
44
 
"""
45
 
 
46
 
CMD_VLAN_ACTIVE_SNIPPET = """
47
 
            <vlan>
48
 
              <vlan-id-create-delete>
49
 
                <__XML__PARAM_value>%s</__XML__PARAM_value>
50
 
                <__XML__MODE_vlan>
51
 
                  <state>
52
 
                    <vstate>active</vstate>
53
 
                  </state>
54
 
                </__XML__MODE_vlan>
55
 
              </vlan-id-create-delete>
56
 
            </vlan>
57
 
"""
58
 
 
59
 
CMD_VLAN_NO_SHUTDOWN_SNIPPET = """
60
 
            <vlan>
61
 
              <vlan-id-create-delete>
62
 
                <__XML__PARAM_value>%s</__XML__PARAM_value>
63
 
                <__XML__MODE_vlan>
64
 
                  <no>
65
 
                    <shutdown/>
66
 
                  </no>
67
 
                </__XML__MODE_vlan>
68
 
              </vlan-id-create-delete>
69
 
            </vlan>
70
 
"""
71
 
 
72
 
CMD_NO_VLAN_CONF_SNIPPET = """
73
 
          <no>
74
 
          <vlan>
75
 
            <vlan-id-create-delete>
76
 
              <__XML__PARAM_value>%s</__XML__PARAM_value>
77
 
            </vlan-id-create-delete>
78
 
          </vlan>
79
 
          </no>
80
 
"""
81
 
 
82
 
CMD_INT_VLAN_HEADER = """
83
 
          <interface>
84
 
            <%s>
85
 
              <interface>%s</interface>
86
 
              <__XML__MODE_if-ethernet-switch>
87
 
                <switchport>
88
 
                  <trunk>
89
 
                    <allowed>
90
 
                      <vlan>"""
91
 
 
92
 
CMD_VLAN_ID = """
93
 
                          <vlan_id>%s</vlan_id>"""
94
 
 
95
 
CMD_VLAN_ADD_ID = """
96
 
                        <add>%s
97
 
                        </add>""" % CMD_VLAN_ID
98
 
 
99
 
CMD_INT_VLAN_TRAILER = """
100
 
                      </vlan>
101
 
                    </allowed>
102
 
                  </trunk>
103
 
                </switchport>
104
 
              </__XML__MODE_if-ethernet-switch>
105
 
            </%s>
106
 
          </interface>
107
 
"""
108
 
 
109
 
CMD_INT_VLAN_SNIPPET = (CMD_INT_VLAN_HEADER +
110
 
                        CMD_VLAN_ID +
111
 
                        CMD_INT_VLAN_TRAILER)
112
 
 
113
 
CMD_INT_VLAN_ADD_SNIPPET = (CMD_INT_VLAN_HEADER +
114
 
                            CMD_VLAN_ADD_ID +
115
 
                            CMD_INT_VLAN_TRAILER)
116
 
 
117
 
CMD_NO_VLAN_INT_SNIPPET = """
118
 
          <interface>
119
 
            <%s>
120
 
              <interface>%s</interface>
121
 
              <__XML__MODE_if-ethernet-switch>
122
 
                <switchport></switchport>
123
 
                <switchport>
124
 
                  <trunk>
125
 
                    <allowed>
126
 
                      <vlan>
127
 
                        <remove>
128
 
                          <vlan>%s</vlan>
129
 
                        </remove>
130
 
                      </vlan>
131
 
                    </allowed>
132
 
                  </trunk>
133
 
                </switchport>
134
 
              </__XML__MODE_if-ethernet-switch>
135
 
            </%s>
136
 
          </interface>
137
 
"""
138
 
 
139
 
FILTER_SHOW_VLAN_BRIEF_SNIPPET = """
140
 
      <show xmlns="http://www.cisco.com/nxos:1.0:vlan_mgr_cli">
141
 
        <vlan>
142
 
          <brief/>
143
 
        </vlan>
144
 
      </show>
145
 
"""
146
 
 
147
 
CMD_VLAN_SVI_SNIPPET = """
148
 
<interface>
149
 
    <vlan>
150
 
        <vlan>%s</vlan>
151
 
        <__XML__MODE_vlan>
152
 
            <no>
153
 
              <shutdown/>
154
 
            </no>
155
 
            <ip>
156
 
                <address>
157
 
                    <address>%s</address>
158
 
                </address>
159
 
            </ip>
160
 
        </__XML__MODE_vlan>
161
 
    </vlan>
162
 
</interface>
163
 
"""
164
 
 
165
 
CMD_NO_VLAN_SVI_SNIPPET = """
166
 
<no>
167
 
    <interface>
168
 
        <vlan>
169
 
            <vlan>%s</vlan>
170
 
        </vlan>
171
 
    </interface>
172
 
</no>
173
 
"""