-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 6ab0dbb
Showing
79 changed files
with
9,376 additions
and
0 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
|
||
# Required Parameters: | ||
# azName: availability zone name | ||
# | ||
# Examples: | ||
# --extra-vars "azName='room1'" | ||
# | ||
- name: Get AZ by name | ||
hosts: localhost | ||
vars_files: | ||
- ../global.yml | ||
gather_facts: no | ||
become: no | ||
tasks: | ||
- import_tasks: ../user/login.yml | ||
|
||
- name: Get AZ by name | ||
uri: | ||
url: "https://{{DJ.host}}:{{DJ.port}}/rest/{{ URI.azs }}?az_name={{azName|urlencode}}" | ||
method: GET | ||
validate_certs: no | ||
headers: | ||
Accept: "application/json" | ||
Content-Type: "application/json;charset=utf8" | ||
X-Auth-Token: "{{DJ.token}}" | ||
register: AZ | ||
|
||
- name: Check AZ | ||
vars: | ||
query: "[?name=='{{ azName }}']" | ||
debug: | ||
msg: "No matched AZ: '{{ azName }}'" | ||
when: AZ.json.az_list | json_query(query) | length < 1 | ||
|
||
- name: Show AZ | ||
vars: | ||
query: "[?name=='{{ azName }}']" | ||
debug: | ||
msg: "{{ AZ.json.az_list | json_query(query) }}" | ||
when: AZ.json.az_list | json_query(query) | length >= 1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
--- | ||
|
||
# Optional Parameters: | ||
# pageNo: page number, default 1 | ||
# pageSize: page size, default: 10 | ||
# sortKey: sort key, options: name | ||
# sortDir: sort direction, default: asc, options: desc, asc | ||
# azName: availability zone name | ||
# | ||
# Examples: | ||
# --extra-vars "azName='room' sortKey='name' sortDir='desc'" | ||
# | ||
- name: List AZs | ||
hosts: localhost | ||
vars: | ||
pageNo: 1 | ||
pageSize: 10 | ||
params: "{{'limit=' + pageSize|string + '&start=' + (pageSize|int * (pageNo|int - 1) + 1) | string }}" | ||
sortDir: asc | ||
vars_files: | ||
- ../global.yml | ||
gather_facts: no | ||
become: no | ||
tasks: | ||
- import_tasks: ../user/login.yml | ||
|
||
- name: Set params - sortKey & sortDir | ||
set_fact: | ||
params: "{{ params + '&sort_key=' + sortKey + '&sort_dir=' + sortDir }}" | ||
when: | ||
- sortKey is defined | ||
|
||
- name: Set params - azName | ||
set_fact: | ||
params: "{{ params + '&az_name=' + azName|urlencode }}" | ||
when: | ||
- azName is defined | ||
|
||
- name: Show Param | ||
debug: | ||
msg: "{{params}}" | ||
|
||
- name: List AZs | ||
uri: | ||
url: "https://{{DJ.host}}:{{DJ.port}}/rest/{{ URI.azs }}?{{params}}" | ||
method: GET | ||
validate_certs: no | ||
headers: | ||
Accept: "application/json" | ||
Content-Type: "application/json;charset=utf8" | ||
X-Auth-Token: "{{DJ.token}}" | ||
register: AZs | ||
|
||
- name: Show AZs | ||
vars: | ||
objList: "{{ AZs.json.az_list }}" | ||
totalNum: "{{AZs.json.total}}" | ||
sortDesc: "{{ 'True' if sortDir == 'desc' else 'False' }}" | ||
debug: | ||
msg: | ||
objList: "{{ ( objList | sort(attribute=sortKey,reverse=sortDesc) ) if sortKey is defined else ( objList | sort(reverse=sortDesc) ) }}" | ||
totalNum: "{{ totalNum }}" | ||
pageSize: "{{ pageSize }}" | ||
pageNo: "{{ pageNo }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
# Required Parameters: | ||
# objType: object type name, see ../global.yml to get supported object types in INVENTORY | ||
# instanceId: instance ID | ||
# | ||
# Examples: | ||
# --extra-vars "objType=volume instanceId=07C1C88199643614A4836E725C73F17D" | ||
|
||
# Generated Parameters (can be overwritten): | ||
# className: CI class Name, see ../global.yml to get supported className in INVENTORY.objType.className | ||
# | ||
# Examples: | ||
# --extra-vars "className=SYS_Lun instanceId=07C1C88199643614A4836E725C73F17D" | ||
|
||
- name: GET Instance by ID | ||
hosts: localhost | ||
vars: | ||
className: "{{ INVENTORY[objType].className }}" # map objType to className | ||
vars_files: | ||
- ../global.yml | ||
gather_facts: no | ||
become: no | ||
tasks: | ||
- import_tasks: ../user/login.yml | ||
|
||
- name: Get Instance | ||
uri: | ||
url: "https://{{DJ.host}}:{{DJ.port}}/rest/{{URI.instances}}/{{className}}/{{instanceId}}" | ||
method: GET | ||
validate_certs: no | ||
headers: | ||
Accept: "application/json" | ||
Content-Type: "application/json;charset=utf8" | ||
X-Auth-Token: "{{DJ.token}}" | ||
register: INSTANCE | ||
|
||
- name: Show Instance | ||
debug: | ||
msg: "{{ INSTANCE.json }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
|
||
- name: GET Relation by ID | ||
hosts: localhost | ||
vars_files: | ||
- ../global.yml | ||
gather_facts: no | ||
become: no | ||
tasks: | ||
- import_tasks: ../user/login.yml | ||
|
||
- name: Get Relation | ||
uri: | ||
url: "https://{{DJ.host}}:{{DJ.port}}/rest/{{URI.relations}}/{{relationName}}/instances/{{instanceId}}" | ||
method: GET | ||
validate_certs: no | ||
headers: | ||
Accept: "application/json" | ||
Content-Type: "application/json;charset=utf8" | ||
X-Auth-Token: "{{DJ.token}}" | ||
register: RELATION | ||
|
||
- name: Show Relation | ||
debug: | ||
msg: "{{ RELATION.json }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
--- | ||
# Required Parameters: | ||
# objType: object type name, see ../global.yml to get supported object types in INVENTORY | ||
# | ||
# Examples: | ||
# --extra-vars "objType=volume" | ||
# | ||
# Optional Parameters: | ||
# params: query parameters, see Examples | ||
# export: export file path | ||
# sep: separator, default '|' | ||
# | ||
# Examples: | ||
# --extra-vars "params='pageNo=1&pageSize=10'" | ||
# --extra-vars "params='condition={\"constraint\":[{\"simple\":{\"name\":\"dataStatus\",\"operator\":\"equal\",\"value\":\"normal\"}},{\"logOp\":\"and\",\"simple\":{\"name\":\"name\",\"operator\":\"contain\",\"value\":\"ansible\"}}]}'" | ||
# --extra-vars "export='volumes.csv' sep='|'" | ||
# | ||
# Generated Parameters (can be overwritten): | ||
# className: CI class Name, see ../global.yml to get supported className in INVENTORY.objType.className | ||
# | ||
# Examples: | ||
# --extra-vars "className=SYS_Lun" | ||
# | ||
- name: List Instances | ||
hosts: localhost | ||
vars_files: | ||
- ../global.yml | ||
vars: | ||
params: 'pageNo=1&pageSize=10' | ||
className: "{{ INVENTORY[objType].className }}" # map objType to className | ||
gather_facts: no | ||
become: no | ||
tasks: | ||
- import_tasks: ../user/login.yml | ||
|
||
- name: List Instances | ||
uri: | ||
url: "https://{{DJ.host}}:{{DJ.port}}/rest/{{URI.instances}}/{{className}}?{{params|replace(' ','%20')}}" | ||
method: GET | ||
validate_certs: no | ||
headers: | ||
Accept: "application/json" | ||
Content-Type: "application/json;charset=utf8" | ||
X-Auth-Token: "{{DJ.token}}" | ||
register: INSTANCES | ||
|
||
- name: Show Instances | ||
debug: | ||
msg: "{{ INSTANCES.json }}" | ||
when: export is not defined | ||
|
||
- import_tasks: ../util/json2csv.yml | ||
vars: | ||
data: "{{INSTANCES.json.objList}}" | ||
keys: "{{INVENTORY[objType].attributes}}" | ||
file: "{{export}}" | ||
when: | ||
- export is defined | ||
- INSTANCES.json.objList is defined | ||
- INSTANCES.json.objList|length > 0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
--- | ||
# Required Parameters: | ||
# relationName: relation name, see ../global.yml to get supported relations in INVENTORY | ||
# | ||
# Examples: | ||
# --extra-vars "relationName=M_DjHostAttachedLun" | ||
# | ||
# Optional Parameters: | ||
# params: query parameters, see Examples | ||
# export: export file path | ||
# sep: separator, default '|' | ||
# | ||
# Examples: | ||
# --extra-vars "params='pageNo=1&pageSize=10'" | ||
# --extra-vars "params='condition={\"constraint\":[{\"simple\":{\"name\":\"last_Modified\",\"operator\":\"greater%20than\",\"value\":\"1576938117968\"}}]}'" | ||
# --extra-vars "export='volume-map.csv' sep='|'" | ||
|
||
- name: List Relations | ||
hosts: localhost | ||
vars: | ||
params: 'pageNo=1&pageSize=10' | ||
vars_files: | ||
- ../global.yml | ||
gather_facts: no | ||
become: no | ||
tasks: | ||
- import_tasks: ../user/login.yml | ||
|
||
- name: List Relations | ||
uri: | ||
url: "https://{{DJ.host}}:{{DJ.port}}/rest/{{URI.relations}}/{{relationName}}/instances?{{params}}" | ||
method: GET | ||
validate_certs: no | ||
headers: | ||
Accept: "application/json" | ||
Content-Type: "application/json;charset=utf8" | ||
X-Auth-Token: "{{DJ.token}}" | ||
register: RELATIONS | ||
|
||
- name: Show Relations | ||
debug: | ||
msg: "{{ RELATIONS.json }}" | ||
when: export is not defined | ||
|
||
- import_tasks: ../util/json2csv.yml | ||
vars: | ||
data: "{{RELATIONS.json.objList}}" | ||
keys: | ||
- id | ||
- last_Modified | ||
- source_Instance_Id | ||
- target_Instance_Id | ||
file: "{{export}}" | ||
when: | ||
- export is defined | ||
- RELATIONS.json.objList is defined | ||
- RELATIONS.json.objList|length > 0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
--- | ||
|
||
dummy: | ||
|
||
dataset: "stat-storage-disk" | ||
query: | ||
timeRange: | ||
beginTime: 1574179200000 | ||
endTime: 1574665590000 | ||
granularity: "auto" | ||
filters: | ||
dimensions: | ||
- field: "dimensions.object.name" | ||
values: | ||
- "DAE001.3" | ||
dimensions: | ||
- field: "dimensions.object.name" | ||
index: 1 | ||
- field: "timestamp" | ||
index: 2 | ||
metrics: | ||
- field: "metrics.healthScore" | ||
aggType: "avg" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
--- | ||
|
||
dummy: | ||
|
||
dataset: "perf-fcswitch-port" | ||
query: | ||
timeRange: | ||
beginTime: 1574179200000 | ||
endTime: 1574665590000 | ||
granularity: "auto" | ||
filters: | ||
dimensions: | ||
- field: "dimensions.object.name" | ||
values: | ||
- "port0" | ||
- "port2" | ||
dimensions: | ||
- field: "dimensions.object.name" | ||
index: 1 | ||
- field: "dimensions.port.wwn" | ||
index: 2 | ||
- field: "timestamp" | ||
index: 3 | ||
metrics: | ||
- field: "metrics.bandwidth" | ||
aggType: "sum" | ||
- field: "metrics.utility" | ||
aggType: "avg" | ||
- field: "metrics.error" | ||
aggType: "sum" | ||
- field: "metrics.bbCreditZero" | ||
aggType: "sum" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
--- | ||
|
||
- name: Flat Query Dataset | ||
hosts: localhost | ||
vars: | ||
pageNo: 1 | ||
pageSize: 1000 | ||
vars_files: | ||
- ../global.yml | ||
gather_facts: no | ||
become: no | ||
tasks: | ||
- import_tasks: ../user/login.yml | ||
|
||
- name: Show Query | ||
debug: | ||
msg: "{{ query }}" | ||
|
||
- name: Query Dataset | ||
uri: | ||
url: "https://{{DJ.host}}:{{DJ.port}}/rest/{{URI.datasets}}/{{dataset}}?pageNo={{pageNo}}&pageSize={{pageSize}}" | ||
method: POST | ||
validate_certs: no | ||
headers: | ||
Accept: "application/json" | ||
Content-Type: "application/json;charset=utf8" | ||
X-Auth-Token: "{{DJ.token}}" | ||
body_format: json | ||
body: "{{ query }}" | ||
register: RESULT | ||
|
||
- name: Show Result | ||
debug: | ||
msg: "{{ RESULT.json }}" | ||
when: export is not defined | ||
|
||
- import_tasks: ../util/json2csv.yml | ||
vars: | ||
data: "{{ RESULT.json.datas }}" | ||
keys: "{{ RESULT.json.datas[0] | dict2items | json_query('[*].key') }}" | ||
file: "{{ export }}" | ||
when: | ||
- export is defined | ||
- RESULT.json.datas is defined | ||
- RESULT.json.datas|length > 0 |
Oops, something went wrong.