示例#1
0
    def sendLSU(self,seq,srcip,dstip):
        print "Sending LSU Packets: ",self.name
        pwospf_hello = pwospf()
        pwospf_hello.rid = self.rid
        pwospf_hello.type = pwospf.TYPE_LSU
        pwospf_hello.seq = seq
        pwospf_hello.nadv = len(self.adjList[self.rid].items())

        for ne in self.adjList[self.rid].items():
            print ne.subnet
            pwospf_hello.advList.append(IPAddr(ne.subnet).toUnsigned())
            pwospf_hello.advList.append(IPAddr(ne.netmask).toUnsigned())
            pwospf_hello.advList.append(ne.rid)

        ipp = pkt.ipv4()
        ipp.protocol = ipv4.PWOSPF_PROTOCOL
        ipp.srcip = IPAddr(srcip)
        ipp.dstip = IPAddr(dstip)
        ipp.payload = pwospf_hello

        ether = ethernet()
        ether.type = ethernet.IP_TYPE
        ether.payload = ipp

        self.send_ipv4_packet(ether)
示例#2
0
    def sendLSU(self, seq, srcip, dstip):
        print "Sending LSU Packets: ", self.name
        pwospf_hello = pwospf()
        pwospf_hello.rid = self.rid
        pwospf_hello.type = pwospf.TYPE_LSU
        pwospf_hello.seq = seq
        pwospf_hello.nadv = len(self.adjList[self.rid].items())

        for ne in self.adjList[self.rid].items():
            print ne.subnet
            pwospf_hello.advList.append(IPAddr(ne.subnet).toUnsigned())
            pwospf_hello.advList.append(IPAddr(ne.netmask).toUnsigned())
            pwospf_hello.advList.append(ne.rid)

        ipp = pkt.ipv4()
        ipp.protocol = ipv4.PWOSPF_PROTOCOL
        ipp.srcip = IPAddr(srcip)
        ipp.dstip = IPAddr(dstip)
        ipp.payload = pwospf_hello

        ether = ethernet()
        ether.type = ethernet.IP_TYPE
        ether.payload = ipp

        self.send_ipv4_packet(ether)
示例#3
0
    def sendHello(self,entry):
        inf = entry[0]
        srcip = entry[1]
        port = self.intf2Port[inf]
        mac = self.port2Mac[port]

        pwospf_hello = pwospf()
        pwospf_hello.rid = self.rid
        pwospf_hello.type = pwospf.TYPE_HELLO
        pwospf_hello.helloint = self.helloint << 16
        pwospf_hello.netmask = IPAddr("255.255.255.0").toUnsigned()

        ipp = pkt.ipv4()
        ipp.protocol = ipv4.PWOSPF_PROTOCOL
        ipp.srcip = IPAddr(srcip)
        ipp.dstip = IPAddr(ALLSPFRouters)
        ipp.payload = pwospf_hello

        ether = ethernet()
        ether.type = ethernet.IP_TYPE
        ether.src = mac

        ether.dst = ETHER_BROADCAST
        ether.payload = ipp

        msg = of.ofp_packet_out()
        msg.actions.append(of.ofp_action_output(port = port))
        msg.data = ether.pack()
        self.connection.send(msg)
示例#4
0
    def sendHello(self, entry):
        inf = entry[0]
        srcip = entry[1]
        port = self.intf2Port[inf]
        mac = self.port2Mac[port]

        pwospf_hello = pwospf()
        pwospf_hello.rid = self.rid
        pwospf_hello.type = pwospf.TYPE_HELLO
        pwospf_hello.helloint = self.helloint << 16
        pwospf_hello.netmask = IPAddr("255.255.255.0").toUnsigned()

        ipp = pkt.ipv4()
        ipp.protocol = ipv4.PWOSPF_PROTOCOL
        ipp.srcip = IPAddr(srcip)
        ipp.dstip = IPAddr(ALLSPFRouters)
        ipp.payload = pwospf_hello

        ether = ethernet()
        ether.type = ethernet.IP_TYPE
        ether.src = mac

        ether.dst = ETHER_BROADCAST
        ether.payload = ipp

        msg = of.ofp_packet_out()
        msg.actions.append(of.ofp_action_output(port=port))
        msg.data = ether.pack()
        self.connection.send(msg)