def setUp(self):
        '''Creates with in-memory DB'''
        self.conf = {}
        self.conf['dbUrl'] = 'sqlite:///'
        self.conf['httpServer'] = {'ipAddr': '127.0.0.1'}
        self.ztpServer = ZtpServer(self.conf)

        self.session = self.ztpServer.dao.Session()
Beispiel #2
0
    def setupZTP(self):
        '''
        Setup Zero Touch Provisioning
        Generate DHCP config file 
        Install and restart DHCP server with new dhcp configuration
        '''
        ztpServer = ZtpServer()
        ztpServer.createPodSpecificDhcpConfFile('anotherPod')

        if jnpr.openclos.util.isPlatformUbuntu():
            os.system('sudo apt-get -y install isc-dhcp-server')
            os.system('sudo cp ' + generatedDhcpConf + ' ' + installedDhcpConf)
            os.system("/etc/init.d/isc-dhcp-server restart")

        elif jnpr.openclos.util.isPlatformCentos():
            os.system('yum -y install dhcp')
            os.system('sudo cp ' + generatedDhcpConf + ' ' + installedDhcpConf)
            os.system("/etc/rc.d/init.d/dhcpd restart")
Beispiel #3
0
    def setupZTP(self):
        '''
        Setup Zero Touch Provisioning
        Generate DHCP config file 
        Install and restart DHCP server with new dhcp configuration
        '''
        ztpServer = ZtpServer()
        with ztpServer._dao.getReadSession() as session:
            ztpServer.createPodSpecificDhcpConfFile(session, self.pod.id)
            print generatedDhcpConf

        if jnpr.openclos.util.isPlatformUbuntu():
            os.system('sudo apt-get -y install isc-dhcp-server')
            os.system('sudo cp ' + generatedDhcpConf + ' ' + installedDhcpConf)
            os.system('sudo /usr/sbin/service isc-dhcp-server restart')

        elif jnpr.openclos.util.isPlatformCentos():
            os.system('yum -y install dhcp')
            os.system('sudo cp ' + generatedDhcpConf + ' ' + installedDhcpConf)
            os.system("/etc/rc.d/init.d/dhcpd restart")
Beispiel #4
0
    def setUp(self):
        self.__conf = {}
        self.__conf['httpServer'] = {'ipAddr': '127.0.0.1'}

        self.ztpServer = ZtpServer(self.__conf, daoClass=InMemoryDao)
        self._dao = InMemoryDao.getInstance()