# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2011 Cisco Systems, Inc. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the # License for the specific language governing permissions and limitations # under the License. # # @author: Edgar Magana, Cisco Systems, Inc. # @author: Arvind Somya (asomya@cisco.com) Cisco Systems, Inc. """ Nexus-OS XML-based configuration snippets """ import logging LOG = logging.getLogger(__name__) # The following are standard strings, messages used to communicate with Nexus, EXEC_CONF_SNIPPET = """ <__XML__MODE__exec_configure>%s """ CMD_VLAN_CONF_SNIPPET = """ <__XML__PARAM_value>%s <__XML__MODE_vlan> %s """ CMD_VLAN_ACTIVE_SNIPPET = """ <__XML__PARAM_value>%s <__XML__MODE_vlan> active """ CMD_VLAN_NO_SHUTDOWN_SNIPPET = """ <__XML__PARAM_value>%s <__XML__MODE_vlan> """ CMD_NO_VLAN_CONF_SNIPPET = """ <__XML__PARAM_value>%s """ CMD_INT_VLAN_HEADER = """ <%s> %s <__XML__MODE_if-ethernet-switch> """ CMD_VLAN_ID = """ %s""" CMD_VLAN_ADD_ID = """ %s """ % CMD_VLAN_ID CMD_INT_VLAN_TRAILER = """ """ CMD_INT_VLAN_SNIPPET = (CMD_INT_VLAN_HEADER + CMD_VLAN_ID + CMD_INT_VLAN_TRAILER) CMD_INT_VLAN_ADD_SNIPPET = (CMD_INT_VLAN_HEADER + CMD_VLAN_ADD_ID + CMD_INT_VLAN_TRAILER) CMD_PORT_TRUNK = """ <%s> %s <__XML__MODE_if-ethernet-switch> """ CMD_NO_SWITCHPORT = """ <%s> %s <__XML__MODE_if-ethernet-switch> """ CMD_NO_VLAN_INT_SNIPPET = """ <%s> %s <__XML__MODE_if-ethernet-switch> %s """ FILTER_SHOW_VLAN_BRIEF_SNIPPET = """ """ CMD_VLAN_SVI_SNIPPET = """ %s <__XML__MODE_vlan>
%s
""" CMD_NO_VLAN_SVI_SNIPPET = """ %s """