Statistics
| Branch: | Tag: | Revision:

psng-pyserf / README @ 7df1781e

History | View | Annotate | Download (2.79 KB)

1
### Dependencies
2

    
3
This software requires the following libraries:
4

    
5
argparse_actions
6
pyroute2
7
portalocker
8
serf-python
9

    
10

    
11
### Usage examples
12

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

    
17
## Add a new channel
18

    
19
Suppose you want to add a new channel named "Channel1" and whose source IP
20
address and port are 192.168.100.2 and 6000 respectively. Then you execute the
21
following command:
22

    
23
python psng-pyserf.py -t psngc -a 127.0.0.1 -p 7373 \
24
  set 192.168.100.2 6000 "Channel1" "Reserved"
25

    
26
The last string "Reserved" can be used to specify any additional parameters that
27
can be useful for whoever will receive this channel.
28

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

    
33
NOTE: Adding a new channel propagates a member-update event on the Serf network.
34
If the channel already exist on the list of channels of the local node, then the
35
member-update event is not generated.
36

    
37

    
38
## Delete a channel
39

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

    
45
python psng-pyserf.py -t psngc -a 127.0.0.1 -p 7373 \
46
  del 192.168.100.2 6000
47

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

    
52

    
53
## Running the software in background
54

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

    
59
python psng-pyserf.py -t psngc -a 127.0.0.1 -p 7373 \
60
  bg /tmp/channels.db
61

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

    
71
# channel_name,source_addr,source_port,channel_params
72
Channel1,192.168.100.2,6000,Reserved
73
Cool Channel,192.168.100.3,7000,720p h264
74