Example #1
0
    from emane.shell import ControlPortClient
except:
    from emanesh import ControlPortClient

# optionally specify the txpower value
if len(sys.argv) > 1:
    txPowerdBm = float(sys.argv[1])
else:
    txPowerdBm = 30

# create a control port connection to a running emulator instance
client = ControlPortClient('node-1',47000)

try:
    # retrieve the manifest
    manifest  = client.getManifest()

    phyLayerBuildId = None

    # find the PHY component build id for the lowest NEM instance
    for buildId,componentType,_ in  manifest[min(manifest)]:
        if componentType == 'PHY':
            phyLayerBuildId =  buildId
            break

    # build a mapping of parameter names to data types
    parameterType = {}

    for name,values in client.getConfiguration(phyLayerBuildId).items():
        if values:
            # second values tuple item is the data type
# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
# FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
# COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
# BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
# ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.
#

try:
    from emane.shell import ControlPortClient
except:
    from emanesh import ControlPortClient

from pprint import pprint

# create a control port connection to a running emulator instance
client = ControlPortClient('node-1',47000)

try:
    # retrieve the manifest and print
    pprint(client.getManifest())

finally:
    # terminate the connection
    client.stop()