To know port numbers in openvswitch - sdn

I am running a switch test Switch Test on real environment with one openvswitch and real sdn switch.
I created a bridge on openvswitch and added ports (ex. eth0, eht1). But I want to know logical port numbers (like 1, 2) which command gives me correct information. ovs-ofctl show bridge s1 shows
1(eth3): mac address etc
2(eth4):
5(eth5):
and ovs-dpctl show
port 2: eth3
port 3: eth4
port 4: eth5
But results are not showing proper mapping of physical to logical ports. Observer eth5 in both cases for ofctl it gives 5 and for dpctl it gives 4. Is there any way to get correct port id's.
I personally feel both these commands are not giving correct port ids. To isolate this scenario. On Mininet I created 2 openvswitchs and run dpctl command as above it gives me 1,2,3,4,5,6 as port numbers but I am not able to run the test with these port numbers. For both switches I used 1,2,3 test executes successfully. What I mean it, if I give 1,2,3 port numbers for one switch and 4,5,6 for another switch tests doesn't execute. Any help is much appreciated.

you can use to show ofport
sudo ovs-vsctl -- --columns=name,ofport list Interface

You can use this command to specify the ofport of the port you are adding in the bridge:
ovs-vsctl add-port br0 eth0 -- set Interface eth0 ofport=1

i think you can try ovs-vsctl list Interface

Related

Trying to create a virtual topology using miniedit that should use mqtt traffic

i have to create a virtual topology with miniedit that has to talk using the mqtt sub/pub system.
i'm working on virtualbox (mininet-wifi)
i have installed mosquitto & the clients... using the terminals i have no problem with:
mosquitto_sub -t test
mosquitto_pub -t test -m hello!
but when i emulate the topology on Miniedit with (controller,switch and two hosts), the hosts cannot talk using mosquitto, i think that there is no broker that can handle the communications in the virtual topology, any suggestions?
I tried to connect also to a remote server, using cloudmqtt but i only got failed connection
i expect that using
xterm h1 h2
on the Comand Line Interface of miniedit, i would be capable of make the two hosts talks beetween them using
mosquitto_sub/pub system, because also in the xterm of the host, if i type
service mosquitto status
i obtain that
mosquitto is active
UPDATE
solved.
i just have to run another host in which i type "mosquitto" and the others hosts would just reach it using "mosquitto_sub/pub - h 10.0.0.3 for example
2 brokers (1 on each hosts) won't automatically discover each other when the "link" comes up.
You will have to either manually configure the a bridge between the 2 brokers if you want messages to be shared.
Or pick one and have the clients explicitly connect to that one broker. e.g. the -h option for the mosquitto_pub or mosquitto_sub commands.
I agree with the solution. Let me give more in depth explanation.
Run basic mininet topo with 4 hosts and 4 switches.
mn --topo linear,4
Then open xterm for 3 hosts
xterm h1 h2 h3
Three terminals will pop up. One of them will be the host. on h3's(10.0.0.3) xterm terminal run
mosquitto
On h2(10.0.0.2) subscribe to the topic with;
mosquitto_sub -h 10.0.0.3 -t "home/bedroom/light"
On h1(10.0.0.1) publish a message by;
mosquitto_pub -h 10.0.0.3 -t "home/bedroom/light" -m "ON"
You can now see the message on h2's terminal. Hope it helps.

How to print GPS location to stdout (Ubuntu 16.04 / 18.04)?

I'm a complete newbie with GPS devices on Linux.
I have a GlobalSat G-STAR IV USB device and I would just like to get the GPS location (lat, long) printed to stdout. How can I achieve that? I'm reading about gpsd, but not sure how to get the actual location. The documentation seems old.
Any common tools etc for this?
It seems that with
$ sudo stty -F /dev/ttyUSB0 4800
$ sudo cat /dev/ttyUSB0
I can read some NMEA(?) data from the device:
$GPGGA,113935.199,,,,,0,00,,,M,0.0,M,,0000*5B
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,113935.199,V,,,,,,,100918,,,N*41
$GPGGA,113936.186,,,,,0,00,,,M,0.0,M,,0000*56
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,113936.186,V,,,,,,,100918,,,N*4C
$GPGGA,113937.185,,,,,0,00,,,M,0.0,M,,0000*54
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
$GPRMC,113937.185,V,,,,,,,100918,,,N*4E
$GPGGA,113938.200,,,,,0,00,,,M,0.0,M,,0000*55
$GPGSA,A,1,,,,,,,,,,,,,,,*1E
I still don't see $GPGLL that should contain the location..?
Edit: I also get this:
$ sudo gpsd /dev/ttyUSB0 -N
gpsd:ERROR: can't bind to IPv4 port gpsd, Address already in use
gpsd:ERROR: maybe gpsd is already running!
gpsd:ERROR: can't bind to IPv6 port gpsd, Address already in use
gpsd:ERROR: maybe gpsd is already running!
I have killed all gpsd instances and deleted the socket, but still getting that..
The output you posted from sudo cat /dev/ttyUSB0 is what you would expect for a GPS module, which does not (yet) have a fix, i.e. it does not have enough information to calculate its current position (+other information).
The only information provided by the messages is the current time of day, 11h39m35s, etc. Out of the messages you receive from your GPS module, not only the $GPGLL message can tell you about your location, but also the $GPGGA and $GPRMC messages that you do receive. If your module had a fix, you would not see several commas in a row but actual values in between.
More details about the format of the different messages can be found in this overview.
What is the likely root cause for the missing GPS fix (assuming your hardware + antenna are fine)?
You have just started using this module fresh from the factory and it needs some time to get ahold of its coordinates. The time to first fix for such a brand new device can be up to 15 minutes.
The GPS signal strength is not strong enough at the location of your module.
Therefore my advice:
Make sure that at your location, the GPS signal from the satellites is strong enough. Ideally by moving outdoors.
When your module has never had a fix before, give your module some time. Wait for up to 20 minutes.
GPSD:
GPSD, if installed, is normally started automatically, when you plug in a GPS module. You can check the current status with
systemctl status gpsd.service
systemctl status gpsd.socket
If active, the gpsd deamon reads out the GPS-data coming via the serial interface and provides it to other applications via a socket on a specific port (default: port 2947). In that case the serial port is not accessible anymore by serial monitors.
Steps to make this device work were:
# Switch the device to NMEA mode
sudo gpsctl -f -n /dev/ttyUSB0
# Set baudrate to 4800
sudo stty -F /dev/ttyUSB0 4800
# Start gpsd
gpsd -S 4000 /dev/ttyUSB0
Now create a TCP/IP socket connection to localhost:4000 and say ?WATCH={"enable":true,"json":true}; or use libgps etc:
http://www.catb.org/gpsd/client-howto.html

Emulating a virtual host for UDP communication

First of all this question is not about virtual host in Apache.
I have a network with the following address: 1.1.1.0
I have several host on this network: 1.1.1.1, 1.1.1.2, 1.1.1.3 and 1.1.1.4
The first host send a broadcast UDP paquet answer and expect other host to answer him.
Is it possible for my dev machine (1.1.1.4) to emulate the following virtual host : 1.1.1.5, 1.1.1.6, etc. ?
I'm using QUdpSocket from Qt 5.2.1 on MacOS 10.9 but I am open to any other tech that would help me do the trick.
It depends on you OS.
On linux, you can create multiple virtual network devices, and bind each of those devices to a different network address. The virtual network devices have the name of a real device with a :xxx numeric suffix. For example, if your primary network device is eth0, you can run the command
ifconfig eth0:1 1.1.1.5
to create the virtual device eth0:1 and bind it to the address 1.1.1.5. This is only temporary (it will go away when you reboot); if you want it to come back when you reboot, you can edit the `/etc/network/interfaces file to look something like:
auto eth0
iface eth0 inet static
address 1.1.1.4
netmask 255.255.255.0
gateway 1.1.1.1
auto eth0:1
address 1.1.1.5
netmask 255.255.255.0
the lack of a gateway in the eth0:1 part means that it won't use this interface for routing, so it just exists for receiving packets and explicit binding to an ip address.
Install VirtualBox (here) and make a tiny disk image big enough for a small Linux distro. Run several copies, each one at a different IP address and run a tiny netcat script in each one that listens and sends replies.
#!/bin/bash
while :
do
command=$(nc -ul 1234)
process $command and reply
done
Or, read this and go with Chris's idea which is lighter weight on resources!

How does one run Google refine on a different port than 3333?

By default, google refine listens on port 3333. How does one start it on a different port?
[There some other process that has taken up 3333 and I cannot change that]
Update: Running this on a Mac (10.8.x)
$ ./refine -p 9999
From the documentation: https://github.com/OpenRefine/OpenRefine/wiki/FAQ
You can specify a different port on the command line.
./refine -p <port>
If you edit /Applications/Google Refine.app/Contents/Info.plist
and replace
<string>-Xms256M -Xmx4096M -Drefine.version=r2407</string>
with
<string>-Xms256M -Xmx4096M -Drefine.version=r2407 -Drefine.port=5555</string>
(or whatever port number you need instead of 5555) this should work.
Adapted from the bottom of the OpenRefine instructions page: https://github.com/OpenRefine/OpenRefine/wiki/Installation-Instructions

Node address in Infinispan

I start up an infinispan cache which joins to a cluster. It is the only cache in the cluster.
Now, I connect using JMX to see what ports are being used.
I click on:
CacheManager / MyCache/ CacheManager/ Attributes
Under clusterMembers, I see [mymachine-54202]
Thinking 54202 is the port, I do both a
lsof -i udp
lsof -i tcp
I am on a mac and I can't see anything on 54202. What does 54202 correspond to then?
Thanks
It's a random number to differentiate between multiple caches running on the same box.
For more details, see http://docs.jboss.org/infinispan/5.0/apidocs/config.html#ce_global_transport