Example #1
0
    # exists on the simulator , but the devices are powered off.

    startTime = time.time()

    # Lets power on evry device and fire up a dhcp discover
    msgscmd = simuProtocol_pb2.clientCommand()
    msgscmd.id = CMD_SIMULATOR_SENDMSG
    for cm in cmList:
        pair = msgscmd.devices.add()
        pair.cmMac = cm[0]
        pair.cmtsMac = ''
        pair.msg = 'power_on'
        pair = msgscmd.devices.add()
        pair.cmMac = cm[0]
        pair.cmtsMac = ''
        pair.msg = 'dhcp_discover'

    ans = simulator.sendCommand(msgscmd)

    cmsWithIP = clienttools.waitforips(simulator, totalCM,
                                       CMD_SIMULATOR_GETAMOUNTCMS_WITH_IP)

    print "Simulation time :%.3fs" % (time.time() - startTime)
    print "Booted CM=%d. CM with IP assigned=%d" % (totalCM, cmsWithIP)
    k = raw_input("Press any key to stop simulation:")
    print "Simulator stoped......."

    cmd.id = CMD_SIMULATOR_EXIT

    simulator.sendCommand(cmd)
    msgscmd.id = api.CMD_SIMULATOR_SENDMSG
    for cm in cmList:
        pair = msgscmd.devices.add()
        pair.cmMac = cm[0]
        pair.cmtsMac = ''
        pair.msg = 'power_on'
        pair = msgscmd.devices.add()
        pair.cmMac = cm[0]
        pair.cmtsMac = ''
        pair.msg = 'dhcp_discover'

    # power on all the CMs
    ans = simulator.sendCommand( msgscmd ) 

    # wait till totalCM ips a
    cmsWithIP = clienttools.waitforips(simulator, totalCM, api.CMD_SIMULATOR_GETAMOUNTCMS_WITH_IP, delayBetweenLoops=.2)

	# Lets power on every CPE and fire up a dhcp discover
    msgscmd = simuProtocol_pb2.clientCommand()
    msgscmd.id = api.CMD_SIMULATOR_SENDMSG
    for pc in cpeMacList:
        pair = msgscmd.devices.add()
        pair.cmMac = pc
        pair.cmtsMac = ''
        pair.msg = 'power_on'
        pair = msgscmd.devices.add()
        pair.cmMac = pc
        pair.cmtsMac = ''
        pair.msg = 'dhcp_discover'

    # power on all the CMs
Example #3
0
    msgscmd = simuProtocol_pb2.clientCommand()
    msgscmd.id = api.CMD_SIMULATOR_SENDMSG
    for cm in cmList:
        pair = msgscmd.devices.add()
        pair.cmMac = cm[0]
        pair.cmtsMac = ''
        pair.msg = 'power_on'
        pair = msgscmd.devices.add()
        pair.cmMac = cm[0]
        pair.cmtsMac = ''
        pair.msg = 'dhcp_discover'

    ans = simulator.sendCommand( msgscmd )

    cmsWithIP = clienttools.waitforips(simulator, totalCM, api.CMD_SIMULATOR_GETAMOUNTCMS_WITH_IP)

    # now, turn on the CPE
    msgscmd = simuProtocol_pb2.clientCommand()
    msgscmd.id = api.CMD_SIMULATOR_SENDMSG
    pair = msgscmd.devices.add()
    pair.cmMac = 'cc:cc:cc:cc:01:01' 
    pair.cmtsMac = ''
    pair.msg = 'power_on'
    pair = msgscmd.devices.add()
    pair.cmMac = 'cc:cc:cc:cc:01:01' 
    pair.cmtsMac = ''
    pair.msg = 'dhcp_discover'
    # send them to simulator....
    ans = simulator.sendCommand( msgscmd )
    if (ans.id == api.ANS_ERR): stopSimulatior(simulator, ans.msg )
Example #4
0
	# Lets power on evry device and fire up a dhcp discover
    msgscmd = simuProtocol_pb2.clientCommand()
    msgscmd.id = CMD_SIMULATOR_SENDMSG
    for cm in cmList:
        pair = msgscmd.devices.add()
        pair.cmMac = cm[0]
        pair.cmtsMac = ''
        pair.msg = 'power_on'
        pair = msgscmd.devices.add()
        pair.cmMac = cm[0]
        pair.cmtsMac = ''
        pair.msg = 'dhcp_discover'

    ans = simulator.sendCommand( msgscmd )

    cmsWithIP = clienttools.waitforips(simulator, totalCM, CMD_SIMULATOR_GETAMOUNTCMS_WITH_IP)

    print "Simulation time :%.3fs" % (time.time() - startTime)
    print "Booted CM=%d. CM with IP assigned=%d" % (totalCM, cmsWithIP)
    k = raw_input("Press any key for a renew stop simulation:")

    # build a command with dhcp renew
    msgscmd = simuProtocol_pb2.clientCommand()
    msgscmd.id = CMD_SIMULATOR_SENDMSG
    for device in cmList:
        pair = msgscmd.devices.add()
        pair.cmMac = device[0]
        pair.cmtsMac = ''
        pair.msg = 'dhcp_renew'

    # send the renew command
Example #5
0
    for cm in cmList:
        pair = msgscmd.devices.add()
        pair.cmMac = cm[0]
        pair.cmtsMac = ''
        pair.msg = 'power_on'
    # power on all the CMs
    ans = simulator.sendCommand(msgscmd)

    # now lets shoot dhcp discover
    for cm in cmList:
        msgscmd = simuProtocol_pb2.clientCommand()
        msgscmd.id = CMD_SIMULATOR_SENDMSG
        pair = msgscmd.devices.add()
        pair.cmMac = cm[0]
        pair.cmtsMac = ''
        pair.msg = 'dhcp_discover'
        ans = simulator.sendCommand(msgscmd)
        #time.sleep(.02) # do not send them all togheter

    cmsWithIP = clienttools.waitforips(simulator,
                                       totalCM,
                                       CMD_SIMULATOR_GETAMOUNTCMS_WITH_IP,
                                       delayBetweenLoops=.2)

    print "Simulation time :%.3fs" % (time.time() - startTime)
    print "Booted CM=%d. CM with IP assigned=%d" % (totalCM, cmsWithIP)
    k = raw_input("Press any key to stop simulation:")
    #print "Simulator stoped......."
    cmd.id = CMD_SIMULATOR_EXIT
    simulator.sendCommand(cmd)