[[Include(WikiToC)]]
== Service: RF Switch
This service is used to configure the RF switch boxes attached to certain nodes in sb1.cosmos-lab.org and sb2.cosmos-lab.org allowing the experimenter to select how nodes and antennas are connected.
RF Switch Boxes:
 ||= '''Name''' =||= '''Location''' =||= '''Connected !Nodes/Devices''' =||
 ||  rfsw1.sb1.cosmos-lab.org  ||  COSMOS Sandbox 1  ||  rfdev3-1, rfdev3-2, rfdev3-5  ||
 ||  rfsw2.sb1.cosmos-lab.org  ||  COSMOS Sandbox 1  ||  rfdev3-2, rfdev3-4, rfdev3-6  ||
 ||  rfsw-s1-lg1.sb2.cosmos-lab.org  ||  COSMOS Sandbox 2  ||  sdr1-s1-lg1, sdr2-s1-lg1  ||
 ||  rfsw-md1.sb2.cosmos-lab.org  ||  COSMOS Sandbox 2  ||  sdr1-md1, sdr2-md1  ||
Please visit the [wiki:hardware/Domains individual sandbox specific pages] in the wiki for detailed block diagrams of the possible RF connections that can be made.
[[BR]]
=== Usage ===
All the available methods are accessible from the a testbed console via an HTTP API located at `am1.cosmos-lab.org:5054/rf_switch`. This API can be interacted with via a command line tool such as "curl" or any script using a "REST client" library.
[[BR]]
=== Get the current configuration ===
This API call is used to get the current configuration of the RF switch box(es). The response will specify the switch/port configurations of the RF switch box(es) in question.
HTTP API Path: `am1.cosmos-lab.org:5054/rf_swtich/status`
Parameters:
 ||= '''Name''' =||= '''Decription''' =||= '''Required''' =||= '''Acceptable Input''' =||
 ||  name ||  Comma separated list of RF switch box FQDNs  ||  Y  ||  (list of RF switch boxes)  ||
[[BR]]
==== Example 1 ====
HTTP Request:
{{{
am1.cosmos-lab.org:5054/rf_switch/status?name=rfsw1.sb1.cosmos-lab.org
}}}
Response:
{{{
  
    
    
    
    
  
}}}
[[BR]]
==== Example 2 ====
HTTP Request:
{{{
am1.cosmos-lab.org:5054/rf_switch/status?name=rfsw1.sb1.cosmos-lab.org,rfsw2.sb1.cosmos-lab.org
}}}
Response:
{{{
  
    
    
    
    
  
  
    
    
    
    
  
}}}
[[BR]]
=== Configure the RF switch ===
HTTP API Path: `am1.cosmos-lab.org:5054/rf_switch/set`
Parameters:
 ||= '''Name''' =||= '''Decription''' =||= '''Required''' =||= '''Acceptable Input''' =||
 ||  name ||  Comma separated list of RF switch box FQDNs  ||  Y  ||  (list of RF switch boxes)  ||
 ||  switch  ||  Comma separated list of switch(es) to configure  ||  Y  ||  (list of switch numbers)  ||
 ||  port ||  Port to select on RF switch  ||  Y  ||  1, 2  ||
[[BR]]
==== Example 1 ====
For `rfsw1.sb1.cosmos-lab.org` and `rfsw2.sb1.cosmos-lab.org`, configure switches `2` and `3` to the second port.
HTTP Request:
{{{
am1.cosmos-lab.org:5054/rf_switch/set?name=rfsw1.sb1.cosmos-lab.org,rfsw2.sb1.cosmos-lab.org&switch=2,3&port=2
}}}
Response:
{{{
  OK
}}}