diff --git a/CHANGELOG.md b/CHANGELOG.md index a6586cd..800eda6 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,8 @@ +# 0.1.7 Release + +## New Features + - Add NAT support for MCR VXC Connections. + # 0.1.6 Release ## New Features diff --git a/service/vxc/aws_unit_test.go b/service/vxc/aws_unit_test.go index b153bd3..fc7a59d 100644 --- a/service/vxc/aws_unit_test.go +++ b/service/vxc/aws_unit_test.go @@ -26,7 +26,7 @@ import ( *********************/ const ( - TEST_1_REFERENCE_STRING = `[{"associatedVxcs":[{"productName":"VXC MCR to AWSHC from GO","rateLimit":500,"aEnd":{"vlan":0,"partnerConfig":{"interfaces":[{"ipAddresses":["10.192.0.25/29"],"bfd":{"txInterval":300,"rxInterval":300,"multiplier":3},"bgpConnections":[{"peerAsn":64512,"localIpAddress":"10.192.0.25","peerIpAddress":"10.192.0.26","password":"cnn6eaeaETSjvjvjvjv","shutdown":false,"description":"BGP with MED and BFD enabled","medIn":100,"medOut":100,"bfdEnabled":true}]}]}},"bEnd":{"productUid":"b2e0b6b8-2943-4c44-8a07-9ec13060afb2","partnerConfig":{"connectType":"AWSHC","type":"private","ownerAccount":"684021030471"}}}],"productUid":"mcr-id-here"}]` + TEST_1_REFERENCE_STRING = `[{"associatedVxcs":[{"productName":"VXC MCR to AWSHC from GO","rateLimit":500,"aEnd":{"vlan":0,"partnerConfig":{"interfaces":[{"ipAddresses":["10.192.0.25/29"],"natIpAddresses":["10.192.0.25"],"bfd":{"txInterval":300,"rxInterval":300,"multiplier":3},"bgpConnections":[{"peerAsn":64512,"localIpAddress":"10.192.0.25","peerIpAddress":"10.192.0.26","password":"cnn6eaeaETSjvjvjvjv","shutdown":false,"description":"BGP with MED and BFD enabled","medIn":100,"medOut":100,"bfdEnabled":true}]}]}},"bEnd":{"productUid":"b2e0b6b8-2943-4c44-8a07-9ec13060afb2","partnerConfig":{"connectType":"AWSHC","type":"private","ownerAccount":"684021030471"}}}],"productUid":"mcr-id-here"}]` ) func SUCCESS_RESPONSE_MOCK(req *http.Request) *http.Response { @@ -114,6 +114,7 @@ func Test_VXC_MCR_AWS(t *testing.T) { partnerConfigInterface := types.PartnerConfigInterface{ IpAddresses: []string{"10.192.0.25/29"}, + NatIpAddresses: []string{"10.192.0.25"}, Bfd: types.BfdConfig{ TxInterval: 300, RxInterval: 300, diff --git a/service/vxc/vxc.go b/service/vxc/vxc.go index 45aeec4..d4b9566 100644 --- a/service/vxc/vxc.go +++ b/service/vxc/vxc.go @@ -233,6 +233,7 @@ func (v *VXC) MarshallMcrAEndConfig(d *schema.ResourceData) (types.PartnerConfig // init config props ip_addresses_list := []string{} + nat_ip_addresses_list := []string{} bfd_configuration := types.BfdConfig{} bgp_connection_list := []types.BgpConnectionConfig{} @@ -247,13 +248,24 @@ func (v *VXC) MarshallMcrAEndConfig(d *schema.ResourceData) (types.PartnerConfig mcrConfig.IpAddresses = ip_addresses_list } + // extract nat ip addresses list + if nat_ip_addresses, nat_ok := mcr_map["nat_ip_addresses"].([]interface{}); nat_ok { + + for _, nat_ip_address := range nat_ip_addresses { + i := nat_ip_address.(string) + nat_ip_addresses_list = append(nat_ip_addresses_list, i) + } + + mcrConfig.NatIpAddresses = nat_ip_addresses_list + } + // extract BFD settings if bfd_config, bfd_ok := mcr_map["bfd_configuration"].(*schema.Set); bfd_ok && len(bfd_config.List()) > 0 { bfd_config_map := bfd_config.List()[0].(map[string]interface{}) bfd_configuration = types.BfdConfig{ - TxInterval: bfd_config_map["tx_internal"].(int), - RxInterval: bfd_config_map["rx_internal"].(int), + TxInterval: bfd_config_map["tx_interval"].(int), + RxInterval: bfd_config_map["rx_interval"].(int), Multiplier: bfd_config_map["multiplier"].(int), } @@ -330,6 +342,18 @@ func (v *VXC) UnmarshallMcrAEndConfig(vxcDetails types.VXC) (interface{}, error) v.Log.Info(" - ipAddresses field not present") } + // add nat ip addresses to configuration + if nat_slice, nat_ok := partner_interface_map["natIpAddresses"].([]interface{}); nat_ok { + if len(nat_slice) > 0 { + v.Log.Info(" - natIpAddresses field present") + partner_configuration["nat_ip_addresses"] = nat_slice + } else { + v.Log.Info(" - natIpAddresses is empty") + } + } else { + v.Log.Info(" - natIpAddresses field not present") + } + // extract bfd settings bfd_map, bfd_ok := partner_interface_map["bfd"].(map[string]interface{}) if bfd_ok { @@ -337,8 +361,8 @@ func (v *VXC) UnmarshallMcrAEndConfig(vxcDetails types.VXC) (interface{}, error) v.Log.Info(" - bfd field present") // add bfd to configuration partner_configuration["bfd_configuration"] = []interface{}{map[string]interface{}{ - "tx_internal": bfd_map["txInterval"], - "rx_internal": bfd_map["rxInterval"], + "tx_interval": bfd_map["txInterval"], + "rx_interval": bfd_map["rxInterval"], "multiplier": bfd_map["multiplier"], }} diff --git a/service/vxc/vxc_integ_test.go b/service/vxc/vxc_integ_test.go index 2ffdaf6..8b399f9 100644 --- a/service/vxc/vxc_integ_test.go +++ b/service/vxc/vxc_integ_test.go @@ -251,6 +251,7 @@ func TestAWSHostedConnectionBuy(t *testing.T) { Interfaces: []types.PartnerConfigInterface{ types.PartnerConfigInterface{ IpAddresses: []string{"10.0.0.1/30"}, + NatIpAddresses: []string{"10.0.0.1"}, Bfd: types.BfdConfig{ TxInterval: 300, RxInterval: 300, diff --git a/types/vxc_order.go b/types/vxc_order.go index ef2d326..de4a170 100644 --- a/types/vxc_order.go +++ b/types/vxc_order.go @@ -47,6 +47,7 @@ type VXCOrderConfirmation struct { type PartnerConfigInterface struct { IpAddresses []string `json:"ipAddresses,omitempty"` + NatIpAddresses []string `json:"natIpAddresses,omitempty"` Bfd BfdConfig `json:"bfd,omitempty"` BgpConnections []BgpConnectionConfig `json:"bgpConnections,omitempty"` }