Merge "trex_learning: Add learning packet option to T-Rex testing"
[vswitchperf.git] / tools / pkt_gen / xena / json / xena_json_mesh.py
1 # Copyright 2017 Red Hat Inc & Xena Networks.
2 #
3 # Licensed under the Apache License, Version 2.0 (the "License");
4 # you may not use this file except in compliance with the License.
5 # You may obtain 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,
11 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 # See the License for the specific language governing permissions and
13 # limitations under the License.
14
15 # Contributors:
16 #   Dan Amzulescu, Xena Networks
17 #   Christian Trautman, Red Hat Inc.
18 #
19 # Usage can be seen below in unit test. This implementation is designed for one
20 # module two port Xena chassis runs only.
21
22 """
23 Xena JSON module for mesh topology.
24 """
25
26 from tools.pkt_gen.xena.json.xena_json import XenaJSON
27
28
29 class XenaJSONMesh(XenaJSON):
30     """
31     Class to modify and read Xena JSON configuration files. Topology will be set
32     as Mesh.
33     """
34     def __init__(self):
35         super(XenaJSONMesh, self).__init__()
36         self.set_topology_mesh()
37
38     def set_topology_mesh(self):
39         """
40         Set the test topology to Mesh for bi directional full duplex flow
41         :return: None
42         """
43         self.json_data['TestOptions']['TopologyConfig']['Topology'] = 'MESH'
44         self.json_data['TestOptions']['TopologyConfig']['Direction'] = 'BIDIR'
45         self.json_data['PortHandler']['EntityList'][0]['PortGroup'] = "UNDEFINED"
46         self.json_data['PortHandler']['EntityList'][1]['PortGroup'] = "UNDEFINED"