import sys try: 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 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 # create a control port connection to a running emulator instance client = ControlPortClient('node-1', 47000) try: # retrieve the manifest manifest = client.getManifest() # clear all component statistics map(client.clearTable, [component[0] for layers in manifest.values() for component in layers]) finally: # terminate the connection client.stop()
# # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS # "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 # create a control port connection to a running emulator instance client = ControlPortClient('node-1', 47000) try: # set the emulator log level to DEBUG client.setLogLevel(4) finally: # terminate the connection client.stop()
# 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 manifest = client.getManifest() # target the smallest build id component contained in the smallest # NEM id running in the emulator pprint( client.getConfiguration(min([x[0] for x in manifest[min(manifest)]]))) finally: # terminate the connection client.stop()
# "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()
# 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 emane 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 manifest = client.getManifest() pprint( client.getStatisticTable( max([x[0] for x in manifest[max(manifest)]]), ('BroadcastPacketAcceptTable0', 'EventReceptionTable'))) finally: # terminate the connection client.stop()
# 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 manifest = client.getManifest() pprint(client.getStatistic(max([x[0] for x in manifest[max(manifest)]]))) finally: # terminate the connection client.stop()
# 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, ControlPortException except: from emanesh import ControlPortClient, ControlPortException # create a control port connection to a running emulator instance client = ControlPortClient('node-1', 47000) try: # retrieve the manifest manifest = client.getManifest() # attempt to clear non existent statistic client.clearStatistic(min([x[0] for x in manifest[min(manifest)]]), ('foo', )) except ControlPortException, exp: print exp finally: # terminate the connection client.stop()