Пример #1
0
def main():
    args = get_parser().parse_args()
    standard_client, mc_client = thrift_connect(
        args.thrift_ip, args.thrift_port,
        RuntimeAPI.get_thrift_services(args.pre))

    load_json_config(standard_client, args.json)
    PrettyAPI(args.pre, standard_client, mc_client).cmdloop()
Пример #2
0
def main():
    args = runtime_CLI.get_parser().parse_args()

    args.pre = runtime_CLI.PreType.SimplePreLAG

    runtime_CLI.load_json(args.json)

    services = runtime_CLI.RuntimeAPI.get_thrift_services(args.pre)
    services.extend(SimpleSwitchAPI.get_thrift_services())

    standard_client, mc_client, sswitch_client = runtime_CLI.thrift_connect(args.thrift_ip, args.thrift_port, services)

    SimpleSwitchAPI(args.pre, standard_client, mc_client, sswitch_client).cmdloop()
Пример #3
0
def main():
    args = runtime_CLI.get_parser().parse_args()

    runtime_CLI.load_json(args.json)

    services = runtime_CLI.RuntimeAPI.get_thrift_services(args.pre)
    services.extend(SimpleSwitchAPI.get_thrift_services())

    standard_client, mc_client, sswitch_client = runtime_CLI.thrift_connect(
        args.thrift_ip, args.thrift_port, services
    )

    SimpleSwitchAPI(args.pre, standard_client, mc_client, sswitch_client).cmdloop()
Пример #4
0
def main():
    args = runtime_CLI.get_parser().parse_args()

    args.pre = runtime_CLI.PreType.SimplePreLAG

    services = runtime_CLI.RuntimeAPI.get_thrift_services(args.pre)
    services.extend(PsaSwitchAPI.get_thrift_services())

    standard_client, mc_client, pswitch_client = runtime_CLI.thrift_connect(
        args.thrift_ip, args.thrift_port, services)

    runtime_CLI.load_json_config(standard_client, args.json, load_json_psa)

    PsaSwitchAPI(args.pre, standard_client, mc_client,
                 pswitch_client).cmdloop()
Пример #5
0
def main():
    print("Jiarong: Enter sswitch_CLI.py")
    args = runtime_CLI.get_parser().parse_args()

    args.pre = runtime_CLI.PreType.SimplePreLAG

    services = runtime_CLI.RuntimeAPI.get_thrift_services(args.pre)
    services.extend(SimpleSwitchAPI.get_thrift_services())

    standard_client, mc_client, sswitch_client = runtime_CLI.thrift_connect(
        args.thrift_ip, args.thrift_port, services)

    runtime_CLI.load_json_config(standard_client, args.json)

    SimpleSwitchAPI(args.pre, standard_client, mc_client,
                    sswitch_client).cmdloop()
Пример #6
0
def main():
    args = runtime_CLI.get_parser().parse_args()

    args.pre = runtime_CLI.PreType.SimplePreLAG

    services = runtime_CLI.RuntimeAPI.get_thrift_services(args.pre)
    services.extend(SimpleSwitchAPI.get_thrift_services())

    standard_client, mc_client, sswitch_client = runtime_CLI.thrift_connect(
        args.thrift_ip, args.thrift_port, services)

    runtime_CLI.load_json_config(standard_client, args.json)

    if args.command != []:
        for cmd in args.command:
            SimpleSwitchAPI(args.pre, standard_client, mc_client,
                            sswitch_client).onecmd(cmd)
    else:
        SimpleSwitchAPI(args.pre, standard_client, mc_client,
                        sswitch_client).cmdloop()
Пример #7
0
def main():

    global rAPI, rndDesc

    args = get_parser().parse_args()

    standard_client, mc_client = thrift_connect(
        args.thrift_ip, args.thrift_port,
        RuntimeAPI.get_thrift_services(args.pre))

    load_json_config(standard_client, args.json)

    rAPI = RuntimeAPI(args.pre, standard_client, mc_client)

    # PRNG
    rndDesc = Random.new()

    print "sniffing on %s" % args.iface
    sys.stdout.flush()
    sniff(iface=args.iface, prn=handle_pkt(rAPI))
    rndDesc.close()
Пример #8
0
def main():
    args = cli.get_parser().parse_args()
    client = SwitchThriftClient()
    client.AddTable('table_ingress_lag', 'action_set_l2if', '20', '')
    client.ReloadDefaultConfig()
    client.AddTable('table_ingress_lag', 'action_set_l2if', '11', '')
Пример #9
0
# You may obtain a copy of the License at
#
#    http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

from scapy.all import *
import runtime_CLI
from sswitch_CLI import SimpleSwitchAPI
from bm_runtime.standard.ttypes import *

parser = runtime_CLI.get_parser()
parser.add_argument('--cpuport',
                    help='cpu port',
                    type=str,
                    action="store",
                    default='veth250')
args = parser.parse_args()
#don't care about multicast in this example
args.pre = runtime_CLI.PreType.None

services = runtime_CLI.RuntimeAPI.get_thrift_services(args.pre)
services.extend(SimpleSwitchAPI.get_thrift_services())

# standard client deals in tables (add, delete, get)
# mc_client deals with multicast groups
# sswitch_client deals with mirroring
Пример #10
0
def main():
    args = cli.get_parser().parse_args()
    client = SwitchThriftClient()
    client.AddTable('table_ingress_lag', 'action_set_lag_l2if', '0', '0 0 0')