Example #1
0
 def compute_my_ip_addr():
     my_ip='127.0.0.1'
     interface=utils.get_default_ifname()
     try:
         my_ip=ip_address(interface)
     except IOError, (errno, strerror):
             msglog.log('broadway', WARN, 'No ip address configured on this interface %s: Error %d: %s' % (interface, errno, strerror))
             msglog.log('broadway', msglog.types.INFO, 'Use "route add default <interface>" command to configure connected interface!')
Example #2
0
 def start(self):
     self.device_map = {}
     if self.debug: print 'Start modbus tcpip server node'
     if self.parent.__class__ == IP: #then must be an 'internet_protocol' node (1.3)
         self.ip = self.parent.address
     else: #must be directly under the eth# port (1.4)
         self.ip = ip_address(self.parent.name)
     self.server = TcpServerConnection(self.ip, self.udp_port, self)
     CompositeNode.start(self)
     if self.debug: print 'modbus tcpip server node started'
Example #3
0
 def start(self):
     self.device_map = {}
     if self.debug: print 'Start modbus tcpip server node'
     if self.parent.__class__ == IP:  #then must be an 'internet_protocol' node (1.3)
         self.ip = self.parent.address
     else:  #must be directly under the eth# port (1.4)
         self.ip = ip_address(self.parent.name)
     self.server = TcpServerConnection(self.ip, self.udp_port, self)
     CompositeNode.start(self)
     if self.debug: print 'modbus tcpip server node started'
Example #4
0
 def compute_my_ip_addr():
     my_ip = '127.0.0.1'
     interface = utils.get_default_ifname()
     try:
         my_ip = ip_address(interface)
     except IOError, (errno, strerror):
         msglog.log(
             'broadway', WARN,
             'No ip address configured on this interface %s: Error %d: %s' %
             (interface, errno, strerror))
         msglog.log(
             'broadway', msglog.types.INFO,
             'Use "route add default <interface>" command to configure connected interface!'
         )
Example #5
0
 def _generate_filename(self, filenumber=None):
     ip = string.replace(ip_address(self.interface), ".", "-")
     serial = self.serial
     ts = self.parent.scheduled_time()
     date = time.strftime("%m%d%Y_%H-%M-%S", time.gmtime(ts))
     return serial + "_" + ip + "_" + date + self.file_suffix
Example #6
0
 def configure(self, config):
     CompositeNode.configure(self, config)
     set_attribute(self, 'address', ip_address(self.parent.name), config)
Example #7
0
 def configure(self, config):
     CompositeNode.configure(self, config)
     set_attribute(self, 'address', ip_address(self.parent.name), config)
Example #8
0
 def _generate_filename(self, filenumber=None):
     ip = string.replace(ip_address(self.interface), '.', '-')
     serial = self.serial
     ts = self.parent.scheduled_time()
     date = time.strftime('%m%d%Y_%H-%M-%S', time.gmtime(ts))
     return serial + '_' + ip + '_' + date + self.file_suffix