Пример #1
0
def create_vlan(vlanid, pbm='', ubm=''):
    channel = grpc.insecure_channel(hostname)
    stub = autobcm_pb2_grpc.AutoBCMStub(channel)
    request = autobcm_pb2.ConfigRequest(vlanid=vlanid, pbm=pbm, ubm=ubm)
    rv = ''
    response = stub.CreateVLAN(request)
    rv = rv + response.message
    if pbm != '':
        response = stub.AddPorts(request)
        rv = rv + '\n' + response.message
    return rv
Пример #2
0
def rem_ports(vlanid, pbm):
    channel = grpc.insecure_channel(hostname)
    stub = autobcm_pb2_grpc.AutoBCMStub(channel)
    request = autobcm_pb2.ConfigRequest(vlanid=vlanid, pbm=pbm)
    response = stub.RemovePorts(request)
    return response.message
Пример #3
0
def show_vlans():
    channel = grpc.insecure_channel(hostname)
    stub = autobcm_pb2_grpc.AutoBCMStub(channel)
    request = autobcm_pb2.ConfigRequest()
    response = stub.ShowVLANs(request)
    return response.message
Пример #4
0
def destroy_vlan(vlanid):
    channel = grpc.insecure_channel(hostname)
    stub = autobcm_pb2_grpc.AutoBCMStub(channel)
    request = autobcm_pb2.ConfigRequest(vlanid=vlanid)
    response = stub.DestroyVLAN(request)
    return response.message
Пример #5
0
def set_pvlan(vlanid, pbm):
    channel = grpc.insecure_channel(hostname)
    stub = autobcm_pb2_grpc.AutoBCMStub(channel)
    request = autobcm_pb2.ConfigRequest(vlanid=vlanid, pbm=pbm)
    response = stub.SetPVLAN(request)
    return response.message