blob: 518760e91b5d132fe30b62cb24dbad1fb42f5c3b [file] [log] [blame]
Jeffrey Townsendfdea52c2013-12-10 18:20:11 -08001"""
2Platform configuration file
3platform == vpi
4"""
5
6###############################################################################
7#
8# This platform module allows VPI port specifications on the command line.
9#
10###############################################################################
11
12import sys
13import os
14import argparse
15import dppv
16
17# The port specification is passed via the "--platform-args" option to OFTest.
18# Note that we must guard against abbreviations supported by argparse
19if not "--platform-args" in " ".join(sys.argv):
20 raise Exception("--platform-args must be specified")
21
22ap = argparse.ArgumentParser("vpi")
23ap.add_argument("--platform-args")
24(ops, rest) = ap.parse_known_args()
25
26vpi_port_map = {}
27ports = ops.platform_args.split(",")
28for ps in ports:
29 (p, vpi) = ps.split("@")
30 vpi_port_map[int(p)] = vpi
31
32print vpi_port_map;
33
34def platform_config_update(config):
35 """
36 Update configuration for the remote platform
37
38 @param config The configuration dictionary to use/update
39 This routine defines the port map used for this configuration
40 """
41
42 global vpi_port_map
43 config["port_map"] = vpi_port_map.copy()
44 config["caps_table_idx"] = 0
45 #
46 # The class for DataPlanePorts must be specified here:
47 #
48 config['dataplane'] = { 'portclass': dppv.DataPlanePortVPI }
49 config['allow_user'] = True