Exemplo n.º 1
0
 def _setup_options_file( self ):
     # Create ppp options
     pnode = self._get_port_node()
     
     comment = '# Script generated by the broadway framework\n' \
               '# Date: %s for %s\n' % ( str( time.ctime( time.time() ) ),
                                         as_node_url( self ) )
     self._gen_ppp_options( comment )
     
     # mgetty configuration
     mc = MgettyConfig()
     pname = self._get_port_name()
     mstr  = '  speed %d\n' % pnode.baud
     if self._is_parent_modem():
         dnode = self._get_device_node()
         mstr += '  init-chat "" \d%s OK\n' % dnode.init_string
     else:
         mstr += '  direct yes\n'
         mstr += '  data-only yes\n'
         mstr += '  toggle-dtr no\n'
     mstr += '  login-conf-file %s\n' % self.login_config_filename
     
     mc.addPort( pname, mstr)
     mc.save()
            
     # Create chap secrets.
     self._gen_chap_secrets()
     
     # Create pap secrets.
     self._gen_pap_secrets()
Exemplo n.º 2
0
 def _disable( self ):
     if os.path.isfile( self.ppp_file_name ):
         os.remove( self.ppp_file_name )
     
     # Remove port from mgetty configuration.
     mc = MgettyConfig()
     mc.removePort( self._get_port_name() )
     mc.save()
Exemplo n.º 3
0
    def _setup_options_file(self):
        # Create ppp options
        pnode = self._get_port_node()

        comment = '# Script generated by the broadway framework\n' \
                  '# Date: %s for %s\n' % ( str( time.ctime( time.time() ) ),
                                            as_node_url( self ) )
        self._gen_ppp_options(comment)

        # mgetty configuration
        mc = MgettyConfig()
        pname = self._get_port_name()
        mstr = '  speed %d\n' % pnode.baud
        if self._is_parent_modem():
            dnode = self._get_device_node()
            mstr += '  init-chat "" \d%s OK\n' % dnode.init_string
        else:
            mstr += '  direct yes\n'
            mstr += '  data-only yes\n'
            mstr += '  toggle-dtr no\n'
        mstr += '  login-conf-file %s\n' % self.login_config_filename

        mc.addPort(pname, mstr)
        mc.save()

        # Create chap secrets.
        self._gen_chap_secrets()

        # Create pap secrets.
        self._gen_pap_secrets()
Exemplo n.º 4
0
    def _disable(self):
        if os.path.isfile(self.ppp_file_name):
            os.remove(self.ppp_file_name)

        # Remove port from mgetty configuration.
        mc = MgettyConfig()
        mc.removePort(self._get_port_name())
        mc.save()