Exemplo n.º 1
0
 def test_FDT(self):
     n = network.open_interface('IP', 'lo', 1)
     a = '\x81\x05\x00\x06\x00\x05'
     b = Addr('\x55\xAA\x05\xA0\xBA\xC0')
     c = RegisterForeignDevice(b, decode=a)
     f = ForeignDeviceTable()
     f.register_foreign_device(c)
     for x in range(30):
         pause(1.0)
         if len(f.entries) == 0:
             raise 'Foreign device table tick failure, early removal'
     pause(10.0)
     if len(f.entries) != 0:
         raise 'Foreign device table tick failure to remove device'
     #e = '\x81\x0B\x20\x000123456789012345678901234567'
     #o = OriginalBroadcastNPDU(decode=e)
     #r = Addr('\xAA\x55\x05\xA0\xBA\xC0')
     #f.forward_original_broadcast_message(n.network, r, o.npdu)
     #how do I check to see if it made it?
     #g = '\x81\x04\x20\x00\x55\xAA\x05\xA0\xBA\xC01234567890123456789012'
     #h = ForwardedNPDU(decode=g)
     #f.broadcast_forwarded_message(n.network, r, h)
     #f.distribute(n.network, r, h)
     f._stop_ticking()
     network.close_interface(n)
     pass
Exemplo n.º 2
0
	def start(self):
		# Open COM port BEFORE calling to open BACnet interface, so that we can use the
		# Port.open() method, and pass in only the file descriptor to open_interface():
		self.parent.open(1) # specify that port should block to complete read/write ops (default is NON-blocking)
		
		self.interface = network.open_interface('MSTP', self.parent.name, \
														self.network, MACaddr=self.addr, \
														fd_mstp=self.parent.file.fileno())
		_Network.start(self)
Exemplo n.º 3
0
    def start(self):
        # Open COM port BEFORE calling to open BACnet interface, so that we can use the
        # Port.open() method, and pass in only the file descriptor to open_interface():
        self.parent.open(
            1
        )  # specify that port should block to complete read/write ops (default is NON-blocking)

        self.interface = network.open_interface('MSTP', self.parent.name, \
                    self.network, MACaddr=self.addr, \
                    fd_mstp=self.parent.file.fileno())
        _Network.start(self)
Exemplo n.º 4
0
 def start(self):
     if self.debug:
         print 'open interface'
         print str(self.network)
     if self.parent.__class__ == IP: #then under 'internet_protocol node' (<=1.3)
         name = self.parent.parent.name
     else: #must be directly under eth# (1.4)
         name = self.parent.name
     self.interface = network.open_interface('IP', name, self.network, port=self.port)
     if self.debug:
         print 'interface opened, now start children'
         print 'starting BacnetIP'
         print self.children_names()
     _Network.start(self)
Exemplo n.º 5
0
 def start(self):
     if self.debug:
         print 'open interface'
         print str(self.network)
     if self.parent.__class__ == IP:  #then under 'internet_protocol node' (<=1.3)
         name = self.parent.parent.name
     else:  #must be directly under eth# (1.4)
         name = self.parent.name
     self.interface = network.open_interface('IP',
                                             name,
                                             self.network,
                                             port=self.port)
     if self.debug:
         print 'interface opened, now start children'
         print 'starting BacnetIP'
         print self.children_names()
     _Network.start(self)
Exemplo n.º 6
0
work to be covered by the GNU General Public License. However         
the source code for this file must still be made available in         
accordance with section (3) of the GNU General Public License.         
    
This exception does not invalidate any other reasons why a work         
based on this file might be covered by the GNU General Public         
License.
"""
##
# @todo Start making segmentation work.

from mpx.lib.bacnet import network
from mpx.lib.bacnet import npdu
from mpx.lib.bacnet._bacnet import read_property_multiple

network.open_interface('IP', 'eth0', 1)
npdu.debug = 1
network.debug = 1

def testy_poo(x=1):
    props = [(130, 2, 10052, -1), (130, 2, 10121, -1),
             (130, 2, 85, -1), (130, 2, 10080, -1),
             (130, 2, 10120, -1), (130, 2, 10081, -1),
             (130, 2, 10078, -1), (130, 2, 10079, -1)]
    return read_property_multiple(1, props*x)

def try_it():
    try:
        r = testy_poo()
    except:
        import sys
Exemplo n.º 7
0
 def start(self):
     self.interface = network.open_interface('Ethernet', self.parent.name,
                                             self.network)
     _Network.start(self)
Exemplo n.º 8
0
work to be covered by the GNU General Public License. However         
the source code for this file must still be made available in         
accordance with section (3) of the GNU General Public License.         
    
This exception does not invalidate any other reasons why a work         
based on this file might be covered by the GNU General Public         
License.
"""
##
# @todo Start making segmentation work.

from mpx.lib.bacnet import network
from mpx.lib.bacnet import npdu
from mpx.lib.bacnet._bacnet import read_property_multiple

network.open_interface('IP', 'eth0', 1)
npdu.debug = 1
network.debug = 1


def testy_poo(x=1):
    props = [(130, 2, 10052, -1), (130, 2, 10121, -1), (130, 2, 85, -1),
             (130, 2, 10080, -1), (130, 2, 10120, -1), (130, 2, 10081, -1),
             (130, 2, 10078, -1), (130, 2, 10079, -1)]
    return read_property_multiple(1, props * x)


def try_it():
    try:
        r = testy_poo()
    except:
Exemplo n.º 9
0
 def start(self):
     self.interface = network.open_interface('Ethernet', self.parent.name, self.network)
     _Network.start(self)