Пример #1
0
    def run(self):
        """Run server
        """
        # Configure logging
        output.set_mode(self.debug)

        # Create yapc base
        server = core.core()
        ofconn = ofcomm.ofserver(server, self.port)

        # Debugger/Profiler
        # ofcount = ofdbg.of_msg_count(server)

        # OpenFlow Parser
        ofparse = ofevents.parser(server)
        # Switch-host binding
        swhost = switchhost.mac2sw_binding(server)
        # Flow switch
        fsw = fswitch.learningswitch(server, ofconn.connections, self.fpr)
        if self.fpr:
            pfr = ofdbg.show_flow_removed(server)
        # Drop unhandled flows
        fp = default.floodpkt(server, ofconn.connections)

        server.run()

        sys.exit(0)
Пример #2
0
                                       self.__class__.__name__)
                        self.expectedCount += 1
                        snmpget.send(m, ('localhost', 161), snmpget.WALK)
            else:
                output.dbg("SNMP Error : "+event.response.recv_error.prettyPrint(),
                           self.__class__.__name__)
        else:
            output.dbg("Error", self.__class__.__name__)

        if(self.count == self.expectedCount):
            self.server.cleanup()
            
        return True

server = core.core()
output.set_mode("DBG")
snmpget = snmp.reliable_snmp(server)
snmps = snmpcomm.snmp_udp_server(server, 5000)
ps = print_snmp(server)
server.run(runbg=True)

m1 = snmpcomm.xet_message(
    {(1,3,6,1,2,1,1,1,0): None,
     (1,3,6,1,2,1,1,2,0): None})

snmpget.send(m1, ('openflow2.stanford.edu', 161), snmpget.GET)
output.dbg("Sent message 1")
snmpget.send(m1, ('localhost', 161), snmpget.GET)
output.dbg("Sent message 2")

while (ps.count < 2):
Пример #3
0
##Print usage guide
def usage():
    """Display usage
    """
    print "Usage "+sys.argv[0]+" interface pcap_file"
    print "\tInterface pcap feeder"
    print "\tFeeds packet in pcap file into interface"
    print  "Options:"
    print "-h/--help\n\tPrint this usage guide"
    print "-v/--verbose\n\tVerbose output"
    print "--very-verbose\n\tVery verbose output"
    print "-d/--daemon\n\tRun as daemon"

ipf = ifpcap_feeder()
output.set_mode("INFO")

#Parse options and arguments
try:
    opts, args = getopt.getopt(sys.argv[1:], "hvd",
                               ["help","verbose","daemon", 
                                "very-verbose"])
except getopt.GetoptError:
    print "Option error!"
    usage()
    sys.exit(2)

#Parse options
for opt,arg in opts:
    if (opt in ("-h","--help")):
        usage()
Пример #4
0
import yapc.forwarding.switching as fswitch
import yapc.forwarding.default as default
import yapc.util.memcacheutil as mcutil
import yapc.debug.openflow as ofdbg
import yapc.log.sqlite as sqlite
import yapc.log.openflow as oflog

import openwifi.webpage as owweb
import openwifi.googlewebpage as howweb
import openwifi.globals as owglobal
import openwifi.authenticate as owauth
import openwifi.logger as owlog
import sys
import time

output.set_mode("DBG")
mcutil.memcache_mode = mcutil.MEMCACHE_MODE["LOCAL"]
web.config.debug=False

server = yapc.core()
webcleanup = owweb.cleanup(server)
owglobal.server = server
ofconn = ofcomm.ofserver(server)
ofparse = ofevents.parser(server)
swconfig = swstate.dp_config(server, ofconn.connections)
swconfig.default_miss_send_len = 65535
swhost = switchhost.mac2sw_binding(server)
owredirect = owauth.redirect(server, ofconn.connections)
fsw = fswitch.learningswitch(server, ofconn.connections, True)
fp = default.floodpkt(server, ofconn.connections)
#pfr = ofdbg.show_flow_removed(server)
Пример #5
0
import yapc.core as core
import yapc.interface as yapc
import yapc.comm.openflow as ofcomm
import yapc.log.output as output
import yapc.pyopenflow as pyopenflow
import yapc.interactive as interactive
import yapc.events.openflow as ofevents

output.set_mode("WARN")

#Create core and OpenFlow sockets
server = core.core()
ofconn = ofcomm.ofserver(server)
ofparse = ofevents.parser(server)
server.run(runbg=True)

#Create event queue
pktin_event = interactive.event_queue(server, ofevents.pktin.name)