Skip to content

Commit

Permalink
r/ospf_area: add multiple new arguments to interface block
Browse files Browse the repository at this point in the history
Fixes #348, #356
  • Loading branch information
jeremmfr committed Mar 10, 2022
1 parent 0308a76 commit 6c7f43a
Show file tree
Hide file tree
Showing 8 changed files with 975 additions and 81 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

ENHANCEMENTS:

* resource/`junos_ospf_area`: add multiple new arguments to `interface` block (Fixes #348, #356)

BUG FIXES:

## 1.24.1 (February 11, 2022)
Expand Down
131 changes: 131 additions & 0 deletions docs/resources/ospf_area.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ resource junos_ospf_area "demo_area" {

## Argument Reference

-> **Note** Some arguments are not compatible with version `v3` of ospf.

The following arguments are supported:

- **area_id** (Required, String, Forces new resource)
Expand All @@ -36,18 +38,147 @@ The following arguments are supported:
For each interface or interface-range to declare.
- **name** (Required, String)
Name of interface or interface-range.
- **authentication_simple_password** (Optional, String, Sensitive)
Authentication key.
Conflict with `authentication_md5`.
- **authentication_md5** (Optional, Block List)
For each key_id, MD5 authentication key.
See [below for nested schema](#authentication_md5-arguments).
Conflict with `authentication_simple_password`.
- **bandwidth_based_metrics** (Optional, Block Set)
For each bandwidth, configure bandwidth based metrics.
See [below for nested schema](#bandwidth_based_metrics-arguments).
- **bfd_liveness_detection** (Optional, Block)
Bidirectional Forwarding Detection options.
See [below for nested schema](#bfd_liveness_detection-arguments).
- **dead_interval** (Optional, Number)
Dead interval (seconds).
- **demand_circuit** (Optional, Boolean)
Interface functions as a demand circuit.
- **disable** (Optional, Boolean)
Disable OSPF on this interface.
- **dynamic_neighbors** (Optional, Boolean)
Learn neighbors dynamically on a p2mp interface.
- **flood_reduction** (Optional, Boolean)
Enable flood reduction.
- **hello_interval** (Optional, Number)
Hello interval (seconds).
- **interface_type** (Optional, String)
Type of interface.
- **ipsec_sa** (Optional, String)
IPSec security association name.
- **ipv4_adjacency_segment_protected_type** (Optional, String)
Type to define adjacency SID is eligible for protection.
Need to be `dynamic`, `index` or `label`.
- **ipv4_adjacency_segment_protected_value** (Optional, String)
Value for index or label to define adjacency SID is eligible for protection.
- **ipv4_adjacency_segment_unprotected_type** (Optional, String)
Type to define adjacency SID uneligible for protection.
Need to be `dynamic`, `index` or `label`.
- **ipv4_adjacency_segment_unprotected_value** (Optional, String)
Value for index or label to define adjacency SID uneligible for protection.
- **link_protection** (Optional, Boolean)
Protect interface from link faults only.
- **metric** (Optional, Number)
Interface metric.
- **mtu** (Optional, Number)
Maximum OSPF packet size (128..65535).
- **neighbor** (Optional, Block Set)
For each address, configure NBMA neighbor.
See [below for nested schema](#neighbor-arguments).
- **no_advertise_adjacency_segment** (Optional, Boolean)
Do not advertise an adjacency segment for this interface.
- **no_eligible_backup** (Optional, Boolean)
Not eligible to backup traffic from protected interfaces.
- **no_eligible_remote_backup** (Optional, Boolean)
Not eligible for Remote-LFA backup traffic from protected interfaces.
- **no_interface_state_traps** (Optional, Boolean)
Do not send interface state change traps.
- **no_neighbor_down_notification** (Optional, Boolean)
Don't inform other protocols about neighbor down events.
- **node_link_protection** (Optional, Boolean)
Protect interface from both link and node faults.
- **passive** (Optional, Boolean)
Do not run OSPF, but advertise it.
- **passive_traffic_engineering_remote_node_id** (Optional, String)
Advertise TE link information, remote address of the link.
- **passive_traffic_engineering_remote_node_router_id** (Optional, String)
Advertise TE link information, TE Router-ID of the remote node.
- **poll_interval** (Optional, Number)
Poll interval for NBMA interfaces (1..65535).
- **priority** (Optional, Number)
Designated router priority (0..255).
- **retransmit_interval** (Optional, Number)
Retransmission interval (seconds).
- **secondary** (Optional, Boolean)
Treat interface as secondary.
- **strict_bfd** (Optional, Boolean)
Enable strict bfd over this interface
- **te_metric** (Optional, Number)
Traffic engineering metric (1..4294967295).
- **transit_delay** (Optional, Number)
Transit delay (seconds) (1..65535).

---

### authentication_md5 arguments

- **key_id** (Required, Number)
Key ID for MD5 authentication (0..255).
- **key** (Required, String, Sensitive)
MD5 authentication key value.
- **start_time** (Optional, String)
Start time for key transmission (YYYY-MM-DD.HH:MM:SS).

---

### bandwidth_based_metrics arguments

- **bandwidth** (Required, String)
Bandwidth threshold.
Format need to be `(\d)+(m|k|g)?`
- **metric** (Required, Number)
Metric associated with specified bandwidth (1..65535).

---

### bfd_liveness_detection arguments

- **authentication_algorithm** (Optional, String)
Authentication algorithm name.
- **authentication_key_chain** (Optional, String)
Authentication key chain name.
- **authentication_loose_check** (Optional, Boolean)
Verify authentication only if authentication is negotiated.
- **detection_time_threshold** (Optional, Number)
High detection-time triggering a trap (milliseconds).
- **full_neighbors_only** (Optional, Boolean)
Setup BFD sessions only to Full neighbors.
- **holddown_interval** (Optional, Number)
Time to hold the session-UP notification to the client (0..255000 milliseconds).
- **minimum_interval** (Optional, Number)
Minimum transmit and receive interval (1..255000 milliseconds).
- **minimum_receive_interval** (Optional, Number)
Minimum receive interval (1..255000 milliseconds).
- **multiplier** (Optional, Number)
Detection time multiplier (1..255).
- **no_adaptation** (Optional, Boolean)
Disable adaptation.
- **transmit_interval_minimum_interval** (Optional, Number)
Minimum transmit interval (1..255000 milliseconds).
- **transmit_interval_threshold** (Optional, Number)
High transmit interval triggering a trap (milliseconds).
- **version** (Optional, String)
BFD protocol version number.

---

### neighbor arguments

- **address** (Required, String)
Address of neighbor.
- **eligible** (Optional, Boolean)
Eligible to be DR on an NBMA network.

## Attributes Reference

Expand Down
68 changes: 35 additions & 33 deletions junos/constants.go
Original file line number Diff line number Diff line change
@@ -1,37 +1,39 @@
package junos

const (
idSeparator = "_-_"
defaultWord = "default"
evpnWord = "evpn"
inetWord = "inet"
inet6Word = "inet6"
mplsWord = "mpls"
emptyWord = "empty"
matchWord = "match"
permitWord = "permit"
thenWord = "then"
prefixWord = "prefix"
prefixNameWord = "prefix-name"
actionNoneWord = "none"
addWord = "add"
deleteWord = "delete"
setWord = "set"
setLineStart = setWord + " "
st0Word = "st0"
ospfV2 = "ospf"
ospfV3 = "ospf3"
activeW = "active"
asPathAtomicAggregate = "as-path atomic-aggregate"
passiveW = "passive"
discardW = "discard"
disableW = "disable"
dynamicDB = "dynamic-db"
preemptWord = "preempt"
flowControlWords = "flow-control"
noFlowControlWords = "no-flow-control"
loopbackWord = "loopback"
noLoopbackWord = "no-loopback"
actionCos = "class-of-service"
actionMarkDiffServ = "mark-diffserv"
idSeparator = "_-_"
defaultWord = "default"
evpnWord = "evpn"
inetWord = "inet"
inet6Word = "inet6"
mplsWord = "mpls"
emptyWord = "empty"
matchWord = "match"
permitWord = "permit"
thenWord = "then"
prefixWord = "prefix"
prefixNameWord = "prefix-name"
actionNoneWord = "none"
addWord = "add"
deleteWord = "delete"
setWord = "set"
setLineStart = setWord + " "
st0Word = "st0"
ospfV2 = "ospf"
ospfV3 = "ospf3"
activeW = "active"
asPathAtomicAggregate = "as-path atomic-aggregate"
passiveW = "passive"
discardW = "discard"
disableW = "disable"
dynamicDB = "dynamic-db"
preemptWord = "preempt"
flowControlWords = "flow-control"
noFlowControlWords = "no-flow-control"
loopbackWord = "loopback"
noLoopbackWord = "no-loopback"
actionCos = "class-of-service"
actionMarkDiffServ = "mark-diffserv"
authenticationLooseCheck = "authentication loose-check"
noAdaptation = "no-adaptation"
)
4 changes: 2 additions & 2 deletions junos/func_resource_bgp.go
Original file line number Diff line number Diff line change
Expand Up @@ -445,7 +445,7 @@ func setBgpOptsBfd(setPrefix string, bfdLivenessDetection []interface{},
configSet = append(configSet, setPrefixBfd+"authentication key-chain "+bfdLD["authentication_key_chain"].(string))
}
if bfdLD["authentication_loose_check"].(bool) {
configSet = append(configSet, setPrefixBfd+"authentication loose-check")
configSet = append(configSet, setPrefixBfd+authenticationLooseCheck)
}
if bfdLD["detection_time_threshold"].(int) != 0 {
configSet = append(configSet, setPrefixBfd+"detection-time threshold "+
Expand Down Expand Up @@ -500,7 +500,7 @@ func readBgpOptsBfd(item string, bfdRead map[string]interface{}) error {
bfdRead["authentication_algorithm"] = strings.TrimPrefix(itemTrim, "authentication algorithm ")
case strings.HasPrefix(itemTrim, "authentication key-chain "):
bfdRead["authentication_key_chain"] = strings.TrimPrefix(itemTrim, "authentication key-chain ")
case itemTrim == "authentication loose-check":
case itemTrim == authenticationLooseCheck:
bfdRead["authentication_loose_check"] = true
case strings.HasPrefix(itemTrim, "detection-time threshold "):
var err error
Expand Down
4 changes: 2 additions & 2 deletions junos/resource_interface_physical.go
Original file line number Diff line number Diff line change
Expand Up @@ -1426,7 +1426,7 @@ func readInterfacePhysicalParentEtherOpts(confRead *interfacePhysicalOptions, it
case strings.HasPrefix(itemTrimBfdLiveDet, "authentication key-chain "):
parentEtherOptsBFDLiveDetect["authentication_key_chain"] = strings.TrimPrefix(
itemTrimBfdLiveDet, "authentication key-chain ")
case itemTrimBfdLiveDet == "authentication loose-check":
case itemTrimBfdLiveDet == authenticationLooseCheck:
parentEtherOptsBFDLiveDetect["authentication_loose_check"] = true
case strings.HasPrefix(itemTrimBfdLiveDet, "detection-time threshold "):
var err error
Expand Down Expand Up @@ -1464,7 +1464,7 @@ func readInterfacePhysicalParentEtherOpts(confRead *interfacePhysicalOptions, it
}
case strings.HasPrefix(itemTrimBfdLiveDet, "neighbor "):
parentEtherOptsBFDLiveDetect["neighbor"] = strings.TrimPrefix(itemTrimBfdLiveDet, "neighbor ")
case itemTrimBfdLiveDet == "no-adaptation":
case itemTrimBfdLiveDet == noAdaptation:
parentEtherOptsBFDLiveDetect["no_adaptation"] = true
case strings.HasPrefix(itemTrimBfdLiveDet, "transmit-interval minimum-interval "):
var err error
Expand Down
Loading

0 comments on commit 6c7f43a

Please sign in to comment.