Skip to content

Commit

Permalink
Merge pull request #321 from jeremmfr/main
Browse files Browse the repository at this point in the history
Release v1.22.2
  • Loading branch information
jeremmfr authored Dec 7, 2021
2 parents 0ceabfd + fbde11d commit f5376a9
Show file tree
Hide file tree
Showing 21 changed files with 512 additions and 321 deletions.
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,14 @@ ENHANCEMENTS:

BUG FIXES:

## 1.22.2 (December 07, 2021)

BUG FIXES:

* resource/`junos_interface`, `junos_interface_physical`, `junos_interface_logical`: fix detection of missing interfaces with the latest versions of Junos (the `not found` message has been moved from the reply field to the error field in the netconf message)
* resource/`junos_security_ike_gateway`: fix bad value used when adding Junos config with `wildcard` argument inside `distinguished_name` block inside `dynamic_remote` block
* resource/`junos_system_login_user`: fix validation of `name` with a dot that is acceptable for Junos (Fixes [#318](https://github.com/jeremmfr/terraform-provider-junos/issues/318))

## 1.22.1 (November 30, 2021)

BUG FIXES:
Expand Down
64 changes: 33 additions & 31 deletions junos/data_source_interface_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,38 +9,40 @@ import (

// export TESTACC_INTERFACE=<inteface> for choose interface available else it's ge-0/0/3.
func TestAccDataSourceInterface_basic(t *testing.T) {
var testaccInterface string
if os.Getenv("TESTACC_INTERFACE") != "" {
testaccInterface = os.Getenv("TESTACC_INTERFACE")
} else {
testaccInterface = defaultInterfaceTestAcc
}
if os.Getenv("TESTACC_SWITCH") == "" {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccDataSourceInterfaceConfigCreate(testaccInterface),
},
{
Config: testAccDataSourceInterfaceConfigData(testaccInterface),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.junos_interface.testacc_datainterface",
"id", testaccInterface+".100"),
resource.TestCheckResourceAttr("data.junos_interface.testacc_datainterface",
"name", testaccInterface+".100"),
resource.TestCheckResourceAttr("data.junos_interface.testacc_datainterface",
"inet_address.#", "1"),
resource.TestCheckResourceAttr("data.junos_interface.testacc_datainterface",
"inet_address.0.address", "192.0.2.1/25"),
resource.TestCheckResourceAttr("data.junos_interface.testacc_datainterface2",
"id", testaccInterface+".100"),
),
if os.Getenv("TESTACC_DEPRECATED") != "" {
var testaccInterface string
if os.Getenv("TESTACC_INTERFACE") != "" {
testaccInterface = os.Getenv("TESTACC_INTERFACE")
} else {
testaccInterface = defaultInterfaceTestAcc
}
if os.Getenv("TESTACC_SWITCH") == "" {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Steps: []resource.TestStep{
{
Config: testAccDataSourceInterfaceConfigCreate(testaccInterface),
},
{
Config: testAccDataSourceInterfaceConfigData(testaccInterface),
Check: resource.ComposeTestCheckFunc(
resource.TestCheckResourceAttr("data.junos_interface.testacc_datainterface",
"id", testaccInterface+".100"),
resource.TestCheckResourceAttr("data.junos_interface.testacc_datainterface",
"name", testaccInterface+".100"),
resource.TestCheckResourceAttr("data.junos_interface.testacc_datainterface",
"inet_address.#", "1"),
resource.TestCheckResourceAttr("data.junos_interface.testacc_datainterface",
"inet_address.0.address", "192.0.2.1/25"),
resource.TestCheckResourceAttr("data.junos_interface.testacc_datainterface2",
"id", testaccInterface+".100"),
),
},
},
},
PreventPostDestroyRefresh: true,
})
PreventPostDestroyRefresh: true,
})
}
}
}

Expand Down
8 changes: 4 additions & 4 deletions junos/provider_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ func TestProvider_impl(t *testing.T) {
var _ *schema.Provider = junos.Provider()
}

// export TESTACC_SWITCH not empty for test switch options (interface mode trunk, vlan native/members)
// with switch Junos device, else it's test for all others parameters
// (interface inet, 802.3ad, routing instance, security zone/nat/ike/ipsec, etc ).
// Few resources and parameters works on both devices, but most tested without TESTACC_SWITCH
// export TESTACC_SWITCH not empty to test specific switch options
// export TESTACC_ROUTER not empty to test specific router options
// export TESTACC_SRX not empty to test specific SRX options
// export TESTACC_DEPRECATED not empty to launch testacc on deprecated resources

func testAccPreCheck(t *testing.T) {
t.Helper()
Expand Down
2 changes: 1 addition & 1 deletion junos/resource_access_address_assignment_pool_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import (
)

func TestAccJunosAccessAddressAssignmentPool_basic(t *testing.T) {
if os.Getenv("TESTACC_SWITCH") == "" {
if os.Getenv("TESTACC_ROUTER") != "" {
resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
Expand Down
10 changes: 8 additions & 2 deletions junos/resource_chassis_cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,12 @@ resource "junos_interface_physical" "testacc_cluster_int2" {
redundant_parent = "reth0"
}
}
resource "junos_interface_physical" "testacc_cluster" {
name = "` + interFace + `"
}
resource "junos_chassis_cluster" "testacc_cluster" {
fab0 {
member_interfaces = ["` + interFace + `"]
member_interfaces = [junos_interface_physical.testacc_cluster.name]
}
redundancy_group {
node0_priority = 100
Expand Down Expand Up @@ -110,9 +113,12 @@ resource "junos_interface_physical" "testacc_cluster_int2" {
redundant_parent = "reth0"
}
}
resource "junos_interface_physical" "testacc_cluster" {
name = "` + interFace + `"
}
resource "junos_chassis_cluster" "testacc_cluster" {
fab0 {
member_interfaces = ["` + interFace + `"]
member_interfaces = [junos_interface_physical.testacc_cluster.name]
}
redundancy_group {
node0_priority = 100
Expand Down
5 changes: 5 additions & 0 deletions junos/resource_interface.go
Original file line number Diff line number Diff line change
Expand Up @@ -932,6 +932,11 @@ func checkInterfaceExistsOld(interFace string, m interface{}, jnprSess *NetconfO
"</interface-name></get-interface-information>"
reply, err := sess.commandXML(rpcIntName, jnprSess)
if err != nil {
if strings.Contains(err.Error(), " not found\n") ||
strings.HasSuffix(err.Error(), " not found") {
return false, nil
}

return false, err
}
if strings.Contains(reply, " not found\n") {
Expand Down
5 changes: 5 additions & 0 deletions junos/resource_interface_physical.go
Original file line number Diff line number Diff line change
Expand Up @@ -798,6 +798,11 @@ func checkInterfaceExists(interFace string, m interface{}, jnprSess *NetconfObje
"</interface-name></get-interface-information>"
reply, err := sess.commandXML(rpcIntName, jnprSess)
if err != nil {
if strings.Contains(err.Error(), " not found\n") ||
strings.HasSuffix(err.Error(), " not found") {
return false, nil
}

return false, err
}
if strings.Contains(reply, " not found\n") {
Expand Down
5 changes: 4 additions & 1 deletion junos/resource_interface_physical_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -379,9 +379,12 @@ resource "junos_interface_physical" "testacc_interface" {
redundant_parent = "reth0"
}
}
resource "junos_interface_physical" "testacc_interface2" {
name = "` + interFace2 + `"
}
resource "junos_chassis_cluster" "testacc_interface" {
fab0 {
member_interfaces = ["` + interFace2 + `"]
member_interfaces = [junos_interface_physical.testacc_interface2.name]
}
redundancy_group {
node0_priority = 100
Expand Down
Loading

0 comments on commit f5376a9

Please sign in to comment.