|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object | +--SSF.Net.Util.cidrBlock
Tree of CIDR blocks, constructed from a Net configuration using the optional "cidr" attributes provided for Net and link attributes. Each CIDR block in this tree represents one of three things: a Net, a link (ptp or LAN), or a placeholder block that doesn't correspond to any DML attribute, containing multiple link sub-blocks.
The block tree does the bookkeeping to maintain three distinct address maps. The NHI map addresses each network, host, and interface as N1:N2:N3:{...}Nn:H(I). The CIDR map addresses each network and link by its CIDR string, L1/L2/L3../Ln. The IP map addresses each network and link by the IP prefix associated with its CIDR block, and each interface of each host by an IP address offset from the prefix assigned to the link in which it appears as an attached interface.
To construct the three maps together, it suffices to construct a single CIDR block, passing the root network's dmlConfig and an IP prefix within which addresses are to be assigned. The code will make one pass over the DML to create the CIDR block tree and NHI map, another to compute the required address blocksizes for the IP map, and a third to assign IP prefixes and addresses.
The cidrBlock tree then serves as a translation table for all three maps, using utility functions {nhi,ip,cidr}_to_{nhi_ip_cidr}, each of which takes a String as an argument and returns another String.
If "cidr" attributes are partially or totally missing, the code will attempt to automatically supply numbers starting from CIDR_BASE. This is not foolproof, because of the amount of checking that would be involved (for example, the need for an additional pass to create a "reserved CIDR block map"). It's better to either uniformly supply CIDR addresses, or uniformly omit them.
| Field Summary | |
protected cidrBlock |
ancestorBlock
CIDR block where defined |
protected com.renesys.raceway.DML.Configuration |
blockConfig
Cached configuration of the Net or link for which this is the address block descriptor. |
static int |
CIDR_AUTOMATIC
|
static int |
CIDR_BASE
CIDR number from which we number default sub-blocks: e.g., 0 or 1 |
static int |
CIDR_IN_USE
Three-way flag for CIDR addressing. |
static int |
CIDR_INDETERMINATE
|
int |
cidr_number
CIDR block number for this address block descriptor. |
java.lang.String |
cidr_prefix
Global CIDR block address for this descriptor. |
static java.lang.String |
CIDR_SEPARATOR
Separator string for CIDR addresses |
static int |
CIDR_status
|
static int |
CIDR_WIDTH
Number of address bits that make up the entire address space |
protected java.util.Hashtable |
interfaces
Table of interfaces for hosts that appear in this subnet. |
static int |
IP_AUTOMATIC
|
static int |
IP_IN_USE
Three-way flag for IP addressing. |
static int |
IP_INDETERMINATE
|
int |
ip_prefix
IP address prefix assigned to this block. |
int |
ip_prefix_length
Number of prefix bits in the local block of reserved addresses. |
static int |
IP_status
|
protected int |
nextCidr
Next CIDR block number to be auto-assigned within this address block. |
int |
nhi_number
NHI Network Address final component |
java.lang.String |
nhi_prefix
NHI Network Address |
static java.lang.String |
NHI_SEPARATOR
Separator string for NHI addresses |
protected cidrBlock |
parentBlock
CIDR block one level up from this one. |
int |
required
Number of addresses required by this block, including the reserved net and broadcast addresses. |
static boolean |
strict
Set 'strict' to false to disable many CIDR/IP rules. |
protected java.util.Hashtable |
subblocks
Table of CIDR sub-blocks. |
protected java.util.Hashtable |
subnets
Table of sub-Nets. |
| Constructor Summary | |
cidrBlock(com.renesys.raceway.DML.Configuration cfg,
java.lang.String use_IP)
Constructor for a top-level CIDR block, given a DML configuration describing one outermost Net, which may not have an ID or a CIDR block number. |
|
| Method Summary | |
java.util.Enumeration |
cidr_children()
Return the CIDR blocks in the CIDR level underneath this one. |
static java.lang.String |
cidr_concat(java.lang.String pre,
int post)
Concatenate the given CIDR addresses. |
cidrBlock |
cidr_parent()
Return the CIDR block which is one CIDR level up from this one. |
java.lang.String |
configCIDR(com.renesys.raceway.DML.Configuration cfg,
int offset)
|
java.lang.String |
configIP(com.renesys.raceway.DML.Configuration cfg,
int offset)
|
boolean |
contains(int addr)
|
boolean |
contains(int addr,
int preflen)
|
java.lang.String |
defined_in_net()
Return the NHI address of the network in which this CIDR block (Net or Link) was defined. |
void |
dump_by_cidr()
|
void |
dump_by_subnet()
|
java.lang.Object |
getUDA(java.lang.String key)
Retreive the value of a user-defined attribute from this CIDR block descriptor. |
java.lang.Object |
getUDA(java.lang.String key,
java.lang.String kval,
boolean flowdown,
boolean override,
java.lang.String concatString)
Retreive the value of a user-defined attribute from this CIDR block descriptor. |
java.lang.String |
ip_to_nhi(int ipaddr,
int ipprefix)
IP address to NHI address. |
java.lang.String |
ip()
|
static void |
main(java.lang.String[] argv)
|
java.lang.String |
net_nhi_to_ip(java.lang.String nhi_address)
Returns the IP address of the Net whose NHI address is nhi_address. |
cidrBlock |
net_nhi(java.lang.String naddr)
Returns the CIDR block corresponding to the specified Net's NHI address naddr. |
com.renesys.raceway.DML.Configuration |
networkConfiguration()
|
java.util.Enumeration |
nhi_children()
Return the CIDR blocks corresponding to subnets within this one. |
static java.lang.String |
nhi_concat(java.lang.String pre,
int post)
Concatenate the given NHI addresses. |
static java.lang.String |
nhi_concat(java.lang.String pre,
java.lang.String post)
Concatenate the given NHI addresses. |
static java.lang.String |
nhi_host_interface(java.lang.String naddr)
Return 'host(interface)' part of an NHI address: "N1:N2:N3:H(I)" --> "H(I)" |
static java.lang.String |
nhi_host(java.lang.String naddr)
Return 'host' part of an NHI address: "N1:N2:N3:H(I)" --> "H" |
static java.lang.String |
nhi_interface(java.lang.String naddr)
Return 'interface' part of an NHI address: "N1:N2:N3:H(I)" --> "I" |
static java.lang.String |
nhi_net_host(java.lang.String naddr)
Return 'network:host' part of an NHI address: "N1:N2:N3:H(I)" --> "N1:N2:N3:H" |
static java.lang.String |
nhi_net(java.lang.String naddr)
Return 'network' part of an NHI address: "N1:N2:N3:H(I)" --> "N1:N2:N3" |
cidrBlock |
nhi_parent()
Return the CIDR block corresponding to the Net in which this block was defined: not necessarily the parent when multilevel CIDR strings are in use. |
java.lang.String |
nhi_to_cidr(java.lang.String nhi_address)
NHI address to CIDR address |
java.lang.String |
nhi_to_ip(java.lang.String nhi_address)
NHI host address to IP address. |
cidrBlock |
nhi(java.lang.String naddr)
NHI address to CIDR block. |
int |
reserved()
Utility function to compute number of addresses reserved in block |
java.lang.String |
toString()
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final int CIDR_BASE
public static final int CIDR_WIDTH
public static final java.lang.String NHI_SEPARATOR
public static final java.lang.String CIDR_SEPARATOR
public int cidr_number
public java.lang.String cidr_prefix
public int nhi_number
public java.lang.String nhi_prefix
public int ip_prefix
public int ip_prefix_length
public static boolean strict
public static final int CIDR_IN_USE
public static final int CIDR_AUTOMATIC
public static final int CIDR_INDETERMINATE
public static int CIDR_status
public static final int IP_IN_USE
public static final int IP_AUTOMATIC
public static final int IP_INDETERMINATE
public static int IP_status
protected com.renesys.raceway.DML.Configuration blockConfig
protected java.util.Hashtable subnets
protected java.util.Hashtable interfaces
protected cidrBlock ancestorBlock
protected cidrBlock parentBlock
protected java.util.Hashtable subblocks
protected int nextCidr
public int required
| Constructor Detail |
public cidrBlock(com.renesys.raceway.DML.Configuration cfg,
java.lang.String use_IP)
throws com.renesys.raceway.DML.configException
| Method Detail |
public java.lang.String ip()
public java.lang.String ip_to_nhi(int ipaddr,
int ipprefix)
public cidrBlock nhi(java.lang.String naddr)
public cidrBlock net_nhi(java.lang.String naddr)
public java.lang.String net_nhi_to_ip(java.lang.String nhi_address)
public java.lang.String nhi_to_cidr(java.lang.String nhi_address)
public java.lang.String nhi_to_ip(java.lang.String nhi_address)
public java.lang.String defined_in_net()
public static java.lang.String nhi_concat(java.lang.String pre,
java.lang.String post)
public static java.lang.String nhi_concat(java.lang.String pre,
int post)
public static java.lang.String cidr_concat(java.lang.String pre,
int post)
public static java.lang.String nhi_net(java.lang.String naddr)
public static java.lang.String nhi_net_host(java.lang.String naddr)
public static java.lang.String nhi_host_interface(java.lang.String naddr)
public static java.lang.String nhi_interface(java.lang.String naddr)
public static java.lang.String nhi_host(java.lang.String naddr)
public cidrBlock cidr_parent()
public cidrBlock nhi_parent()
public java.util.Enumeration cidr_children()
public java.util.Enumeration nhi_children()
public com.renesys.raceway.DML.Configuration networkConfiguration()
public final int reserved()
public boolean contains(int addr,
int preflen)
public boolean contains(int addr)
public java.lang.String toString()
toString in class java.lang.Objectpublic void dump_by_subnet()
public void dump_by_cidr()
public java.lang.String configIP(com.renesys.raceway.DML.Configuration cfg,
int offset)
throws com.renesys.raceway.DML.configException
com.renesys.raceway.DML.configException
public java.lang.String configCIDR(com.renesys.raceway.DML.Configuration cfg,
int offset)
throws com.renesys.raceway.DML.configException
com.renesys.raceway.DML.configException
public java.lang.Object getUDA(java.lang.String key)
throws com.renesys.raceway.DML.configException
com.renesys.raceway.DML.configException
public java.lang.Object getUDA(java.lang.String key,
java.lang.String kval,
boolean flowdown,
boolean override,
java.lang.String concatString)
throws com.renesys.raceway.DML.configException
com.renesys.raceway.DML.configExceptionpublic static void main(java.lang.String[] argv)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||