1 # Copyright 2016 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
28 def get(cls, network_type):
29 return cls.encaps_mapping.get(network_type.upper(), None)
32 class ChainType(object):
44 def get_chain_type(cls, chain):
45 return cls.chain_mapping.get(chain.upper(), None)
48 class OpenStackSpec(object):
50 self.__vswitch = "BASIC"
51 self.__encaps = Encaps.BASIC
58 def vswitch(self, vsw):
60 raise Exception('Trying to set vSwitch as None.')
62 self.__vswitch = vsw.upper()
69 def encaps(self, enc):
71 raise Exception('Trying to set Encaps as None.')
76 class RunSpec(object):
77 def __init__(self, no_vswitch_access, openstack_spec):
78 self.use_vswitch = (not no_vswitch_access) and openstack_spec.vswitch != "BASIC"
86 def set_openstack_spec(self, openstack_spec):
87 self.openstack = openstack_spec
89 def set_run_spec(self, run_spec):
90 self.run_spec = run_spec