Exemplo n.º 1
0
def json_init(client):
    if client is None:
        print "Unable to request new config from switch because Thrift is unavailable"
        sys.exit(0)
    import bmpy_utils as utils
    json_cfg = utils.get_json_config(standard_client=client)
    name_map.load_names(json_cfg)
Exemplo n.º 2
0
    def json_dependent_init(self):
        self.json_cfg = utils.get_json_config(standard_client=self.standard_client)
        field_map.load_names(self.json_cfg)
        obj_map.load_names(self.json_cfg)

        if not with_runtime_CLI:
            self.with_CLI = False
        else:
            self.with_CLI = True
            self.init_runtime_CLI()
Exemplo n.º 3
0
    def json_dependent_init(self):
        self.json_cfg = utils.get_json_config(
            standard_client=self.standard_client)
        field_map.load_names(self.json_cfg)
        obj_map.load_names(self.json_cfg)

        if not with_runtime_CLI:
            self.with_CLI = False
        else:
            self.with_CLI = True
            self.init_runtime_CLI()
Exemplo n.º 4
0
 def makeThriftLink(self, qdepth, qrate):
     services = self.get_thrift_services(self.thriftPre)
     services.extend(self.ssget_thrift_services())
     self.standard_client, self.mc_client, self.sswitch_client = utils.thrift_connect(
         self.thriftIp, self.thriftPort, services)
     # self.standard_client, self.mc_client = utils.thrift_connect(
     #     self.thriftIp, self.thriftPort, self.get_thrift_services(self.thriftPre))
     self.json_str = utils.get_json_config(
         self.standard_client, self.jsonPath)
     self.load_json_str()
     # self.sswitch_client.set_egress_queue_depth(port, qdepth)
     self.sswitch_client.set_all_egress_queue_depths(qdepth)
     self.sswitch_client.set_all_egress_queue_rates(qrate)
Exemplo n.º 5
0
def main():
    deprecated_args = []
    for a in deprecated_args:
        if getattr(args, a) is not None:
            print("Command line option '--{}' is deprecated".format(a),
                  end=' ')
            print("and will be ignored")

    client = None
    socket_addr = None
    json_cfg = None

    if args.socket is not None:
        socket_addr = args.socket

    if not args.json or not args.socket:
        try:
            import bmpy_utils as utils
        except:
            print(
                "When '--json' or '--socket' is not provided, the client needs bmpy_utils"
            )
            print(
                "bmpy_utils is not available when building bmv2 without Thrift support"
            )
            sys.exit(1)
        client = utils.thrift_connect_standard(args.thrift_ip,
                                               args.thrift_port)
        info = client.bm_mgmt_get_info()
        if info.elogger_socket is None:
            print("The event logger is not enabled on the switch,", end=' ')
            print("run with '--nanolog <addr>'")
            sys.exit(1)
        if args.socket is None:
            socket_addr = info.elogger_socket
            print("'--socket' not provided, using", socket_addr, end=' ')
            print("(obtained from switch)")

        if args.json is None:
            json_cfg = utils.get_json_config(standard_client=client)

    if args.json is not None:
        with open(args.json, 'r') as f:
            json_cfg = f.read()
    name_map.load_names(json_cfg)

    recv_msgs(socket_addr, client)
Exemplo n.º 6
0
def json_init(client):
    json_cfg = utils.get_json_config(standard_client=client)
    name_map.load_names(json_cfg)
def json_init(client):
    json_cfg = utils.get_json_config(standard_client=client)
    name_map.load_names(json_cfg)