Statistics
| Branch: | Tag: | Revision:

psng-pyserf / README.md @ b4050b19

History | View | Annotate | Download (2.81 KB)

1
# Dependencies
2

    
3
This software requires the following libraries: argparse\_actions, pyroute2,
4
portalocker, serf-python.
5

    
6
# Usage examples
7

    
8
In all the examples that follow we assume we want to use "psngc" as the channels
9
tag name (specified with option -t) and that the RPC deamon responds at address
10
127.0.0.1 on port 7373 (specified with options -a and -p respectively).
11

    
12
# Add a new channel
13

    
14
Suppose you want to add a new channel named "Channel1" and whose source IP
15
address and port are 192.168.100.2 and 6000 respectively. Then you execute the
16
following command:
17

    
18
```
19
python psng-pyserf.py -t psngc -a 127.0.0.1 -p 7373 set 192.168.100.2 6000 "Channel1" "Reserved"
20
```
21

    
22
The last string "Reserved" can be used to specify any additional parameters that
23
can be useful for whoever will receive this channel.
24

    
25
NOTE: It is not possible to add two different channel that use the same address
26
and port. This contraint is verified only on the local node, this means that is
27
responsibility of the local node to use the correct source channel IP address.
28

    
29
NOTE: Adding a new channel propagates a member-update event on the Serf network.
30
If the channel already exist on the list of channels of the local node, then the
31
member-update event is not generated.
32

    
33

    
34
# Delete a channel
35

    
36
Channel deletion is based exclusively on the source IP address and port of a
37
channel. The channel name and the "Reserved" string are ignored. Suppose you
38
want to delete the channel that was added in the previous example (address
39
192.168.100.2 and port 6000). The you execute the following command:
40

    
41
```
42
python psng-pyserf.py -t psngc -a 127.0.0.1 -p 7373 del 192.168.100.2 6000
43
```
44

    
45
NOTE: Deleting a channel propagates a member-update event on the Serf network.
46
If the channel is not present in the list of channels that belong to the local
47
node, then the member-update event is not generated.
48

    
49

    
50
# Running the software in background
51

    
52
All the nodes that are interested in keepeing an updted list of channels
53
existing on the network should run the software in background mode with the
54
following command:
55

    
56
```
57
python psng-pyserf.py -t psngc -a 127.0.0.1 -p 7373 bg /tmp/channels.db
58
```
59

    
60
the path specified at the end of the command is the channels database file that
61
the software will use to list the existing channels. This file is written for
62
the first time when the software starts and is updated everytime a channel is
63
added or deleted (this is known by listening to the member-update events). The
64
software use an exclusive file system file lock every time the file is updated.
65
The file is formatted by an header line (starting with the character "#") and by
66
a list of zero or more channels. Here an examples of the channels database file
67
containing two channels:
68

    
69
\# channel\_name,source\_addr,source\_port,channel\_params
70
Channel1,192.168.100.2,6000,Reserved
71
Cool Channel,192.168.100.3,7000,720p h264
72