6
6
- [ Go] ( https://golang.org/doc/install ) >= 1.19
7
7
8
8
9
- ## Building The Provider
9
+ ## Installing The Provider
10
10
11
11
1 . Clone the repository
12
12
2 . Enter the repository directory
@@ -19,44 +19,102 @@ The provider should be available in `$GOPATH/bin`
19
19
20
20
## Using the provider
21
21
22
- The provider is not yet available in hashicorp terraform registry. So ` terrform init ` will not work
23
-
22
+ For using the locally compiled provider:
24
23
Refer https://developer.hashicorp.com/terraform/cli/config/config-file
25
24
Section: Development Overrides for Provider Developers
26
25
To add dev overrides to use a the plugin under development
27
26
28
27
29
- ## Developing the Provider
30
-
31
- See generator/generate.md
32
-
33
-
34
28
## Acceptance Tests
35
29
36
30
``` shell
37
31
./run_accept_tests.sh // Run everything
38
32
./run_accept_tests.sh TestAcc< Pattern of tests> // Run Specific tests
33
+ or
34
+ make testacc // Run everything
39
35
```
40
36
* AT runs on actual NDFC environment
41
- * The testbed settings are stored in ` testing/at_testbeds/ `
42
- * By default it uses ndfc-175
43
- * Use ` TESTBED ` environment variable to change the testbed
44
- * A file `testing/at_testbeds/ndfc_ $(TESTBED).yaml must be present
45
- ** Remember to set fabric names, switch serials etc to match the NDFC in use
46
-
47
- AT run result mandatory for PR approval
48
-
49
- ## Steps to run unit test with mockoon server
50
-
51
- 1 . Install mockoon-cli server
52
- ```
53
- npm install -g @mockoon/cli
54
- ```
55
- 2 . Copy your mockoon environment data json file to ` /terraform-provide-ndfc/mockoon_data.json `
56
- 3 . Create unit test functions with prefix ` TestUT_ ` and use ` ut_client ` as NDFC client variable.
57
- 4 . Run ` ./run_unit_test.sh ` to run the unit test cases.
37
+ * The testbed settings are expected in a yaml file as seen in [ ` testing/testbed.yaml ` ] ( testing/testbed.yaml )
38
+ * export ` TESTBED_FILE ` environment variable to indicate the testbed config to be used for AT
39
+ * The provider settings can be overrided by following environment variables
40
+ ` NDFC_HOST ` , ` NDFC_USER ` , ` NDFC_PASSWORD ` , ` NDFC_DOMAIN `
41
+ ** The fabric names, switch serials etc in the config must match the NDFC being used
58
42
59
43
## Provider plugin Documentation
60
44
[ Provider] ( docs/index.md )
61
45
[ Resources] ( docs/resources )
62
46
[ Datasources] ( docs/data-sources )
47
+
48
+ ## Sample Workflow
49
+
50
+ Following is a sample integrated config that creates a new fabric and adds a switch into it.
51
+ Save this to a ` config.tf ` file, modify the paramters according to the NDFC in use
52
+
53
+ ```
54
+ terraform {
55
+ required_providers {
56
+ ndfc = {
57
+ source = "registry.terraform.io/cisco/ndfc"
58
+ }
59
+ }
60
+ }
61
+
62
+ provider "ndfc" {
63
+ username = "admin"
64
+ password = "test"
65
+ host = "https://my-ndfc"
66
+ insecure = true
67
+ }
68
+
69
+ resource "ndfc_fabric_vxlan_evpn" "my_fabric_1" {
70
+ fabric_name = "my_fabric_name"
71
+ bgp_as = "65000"
72
+ deploy = false
73
+ }
74
+ resource "ndfc_inventory_devices" "test_resource_inventory_devices_1" {
75
+ fabric_name = "my_fabric_name"
76
+ auth_protocol = "md5"
77
+ username = "admin"
78
+ password = "admin_password"
79
+ max_hops = 0
80
+ set_as_individual_device_write_credential = false
81
+ preserve_config = false
82
+ save = true
83
+ deploy = false
84
+ retries = 300
85
+ retry_wait_timeout = 20
86
+ devices = {
87
+ "10.1.1.1" = {
88
+ role = "spine"
89
+ discovery_type = "discover"
90
+ discovery_auth_protocol = "md5"
91
+ }
92
+ }
93
+ }
94
+
95
+ # resource to do a final recalculate and deploy
96
+ resource "ndfc_configuration_deploy" "test_resource_configuration_deploy_1" {
97
+ fabric_name = "my_fabric_name"
98
+ serial_numbers = ["ALL"]
99
+ config_save = true
100
+ trigger_deploy_on_update = false
101
+ # Adding depends on ensures that features are configured in the right order in NDFC
102
+ depends_on = [
103
+ ndfc_inventory_devices.test_resource_inventory_devices_1,
104
+ ndfc_fabric_vxlan_evpn.my_fabric_1
105
+ ]
106
+ }
107
+ ```
108
+
109
+ ### Execute following to configure NDFC
110
+
111
+ ``` shell
112
+ terraform plan
113
+ terraform apply
114
+ ```
115
+
116
+ ### Execute following to cleanup
117
+
118
+ ``` shell
119
+ terraform destroy
120
+ ```
0 commit comments