• 大小: 48.15MB
    文件类型: .gz
    金币: 1
    下载: 0 次
    发布日期: 2023-06-17
  • 语言: 其他
  • 标签: floodlight1.  

资源简介

floodlight-1.2压缩包,Linux系统可以使用,可以直接解压编译

资源截图

代码片段和文件信息

#! /usr/bin/python
“““
Copyright 2013 Big Switch Networks Inc.

Licensed under the Apache License Version 2.0 (the “License“); you may
not use this file except in compliance with the License. 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.

circuitpusher utilizes floodlight rest APIs to create a bidirectional circuit 
i.e. permanent flow entry on all switches in route between two devices based 
on IP addresses with specified priority.
 
Notes:
 1. The circuit pusher currently only creates circuit with two IP end points 
 2. Prior to sending restAPI requests to the circuit pusher the specified end
    points must already been known to the controller (i.e. already have sent
    packets on the network easy way to assure this is to do a ping (to any
    target) from the two hosts.
 3. The current supported command syntax format is:
    a) circuitpusher.py --controller={IP}:{rest port} --type ip --src {IP} --dst {IP} --add --name {circuit-name}
 
       adds a new circuit between src and dst devices Currently ip circuit is supported. ARP is automatically supported.
    
       Currently a simple circuit record storage is provided in a text file circuits.json in the working directory.
       The file is not protected and does not clean itself between controller restarts.  The file is needed for correct operation
       and the user should make sure deleting the file when floodlight controller is restarted.

    b) circuitpusher.py --controller={IP}:{rest port} --delete --name {circuit-name}

       deletes a created circuit (as recorded in circuits.json) using the previously given name

@author kcwang
“““

import os
import sys
import subprocess
import json
import argparse
import io
import time

# parse circuit options.  Currently supports add and delete actions.
# Syntax:
#   circuitpusher --controller {IP:REST_PORT} --add --name {CIRCUIT_NAME} --type ip --src {IP} --dst {IP} 
#   circuitpusher --controller {IP:REST_PORT} --delete --name {CIRCUIT_NAME}

parser = argparse.ArgumentParser(description=‘Circuit Pusher‘)
parser.add_argument(‘--controller‘ dest=‘controllerRestIp‘ action=‘store‘ default=‘localhost:8080‘ help=‘controller IP:RESTport e.g. localhost:8080 or A.B.C.D:8080‘)
parser.add_argument(‘--add‘ dest=‘action‘ action=‘store_const‘ const=‘add‘ default=‘add‘ help=‘action: add delete‘)
parser.add_argument(‘--delete‘ dest=‘action‘ action=‘store_const‘ const=‘delete‘ default=‘add‘ help=‘action: add delete‘)
parser.add_argument(‘--type‘ dest=‘type‘ action=‘store‘ default=‘ip‘ help=‘valid types: ip‘)
parser.add_argument(‘--src‘ dest=‘srcAddress‘ action=‘store‘ default=‘0.

评论

共有 条评论

相关资源