k2hr3-api 1.0.38 → 1.0.40

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (65) hide show
  1. package/ChangeLog +12 -0
  2. package/README.md +31 -31
  3. package/app.js +6 -10
  4. package/bin/run.sh +21 -21
  5. package/bin/www +1 -1
  6. package/config/k2hr3-init.sh.templ +5 -5
  7. package/eslint.config.mjs +68 -0
  8. package/lib/cacerts.js +8 -7
  9. package/lib/dummyuserapi.js +1 -1
  10. package/lib/ipwatch.js +1 -1
  11. package/lib/k2hr3acrutil.js +12 -14
  12. package/lib/k2hr3apiutil.js +5 -5
  13. package/lib/k2hr3cryptutil.js +2 -0
  14. package/lib/k2hr3dkc.js +25 -28
  15. package/lib/k2hr3template.js +54 -52
  16. package/lib/k2hr3tokens.js +4 -4
  17. package/lib/k8soidc.js +3 -3
  18. package/lib/openstackapiv2.js +51 -52
  19. package/lib/openstackapiv3.js +86 -87
  20. package/lib/openstackep.js +46 -46
  21. package/package.json +8 -8
  22. package/routes/acr.js +66 -110
  23. package/routes/debugVerify.js +12 -14
  24. package/routes/extdata.js +24 -40
  25. package/routes/list.js +24 -36
  26. package/routes/policy.js +72 -120
  27. package/routes/resource.js +110 -165
  28. package/routes/role.js +177 -295
  29. package/routes/service.js +54 -90
  30. package/routes/userTokens.js +1 -1
  31. package/routes/userdata.js +12 -20
  32. package/routes/version.js +39 -23
  33. package/tests/auto_control_subprocess.sh +9 -9
  34. package/tests/auto_init_config_json.sh +3 -3
  35. package/tests/auto_resource.js +417 -478
  36. package/tests/auto_role.js +55 -71
  37. package/tests/auto_template.sh +4 -4
  38. package/tests/auto_version.js +39 -23
  39. package/tests/k2hdkc_test_load.sh +9 -9
  40. package/tests/k2hr3template_test.sh +12 -12
  41. package/tests/k2hr3template_test_vars.js +60 -62
  42. package/tests/manual_acr_delete.js +11 -12
  43. package/tests/manual_acr_get.js +9 -10
  44. package/tests/manual_acr_postput.js +12 -13
  45. package/tests/manual_extdata_get.js +5 -6
  46. package/tests/manual_list_gethead.js +12 -13
  47. package/tests/manual_policy_delete.js +12 -13
  48. package/tests/manual_policy_gethead.js +27 -27
  49. package/tests/manual_policy_postput.js +21 -23
  50. package/tests/manual_resource_delete.js +11 -15
  51. package/tests/manual_resource_gethead.js +11 -14
  52. package/tests/manual_resource_postput.js +18 -21
  53. package/tests/manual_role_delete.js +22 -28
  54. package/tests/manual_role_gethead.js +53 -53
  55. package/tests/manual_role_postput.js +28 -31
  56. package/tests/manual_service_delete.js +11 -13
  57. package/tests/manual_service_gethead.js +13 -15
  58. package/tests/manual_service_postput.js +10 -11
  59. package/tests/manual_test.sh +10 -10
  60. package/tests/manual_userdata_get.js +14 -15
  61. package/tests/manual_usertoken_gethead.js +12 -14
  62. package/tests/manual_usertoken_postput.js +23 -26
  63. package/tests/manual_version_get.js +12 -13
  64. package/tests/run_local_test_k2hdkc.sh +4 -4
  65. package/tests/test.sh +12 -12
@@ -1082,16 +1082,14 @@ describe('API : ROLE', function(){ // eslint-disable-line no-undef
1082
1082
  // Run Test(PUT - NEW SET - SUCCESS/FAILURE)
1083
1083
  //
1084
1084
  it('PUT /v1/role : set all new role(autotest_put_dummy_role1) by scoped token with status 201', function(done){ // eslint-disable-line no-undef
1085
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
1086
1085
  var uri = '/v1/role';
1087
- uri += '?name=autotest_put_dummy_role1'; // path: yrn:yahoo:::tenant0:role:autotest_put_dummy_role1
1088
- uri += '&policies=' + JSON.stringify([ // policies: yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03
1089
- 'yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03'
1090
- ]);
1091
- uri += '&alias=' + JSON.stringify([ // alias: yrn:yahoo:::tenant0:role:autotest_put_dummy_role2(not exist)
1092
- 'yrn:yahoo:::tenant0:role:autotest_put_dummy_role2'
1093
- ]);
1094
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
1086
+ uri += '?name=autotest_put_dummy_role1'; // path: yrn:yahoo:::tenant0:role:autotest_put_dummy_role1
1087
+ uri += '&policies=' + JSON.stringify([
1088
+ 'yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03' // policies: yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03
1089
+ ]);
1090
+ uri += '&alias=' + JSON.stringify([
1091
+ 'yrn:yahoo:::tenant0:role:autotest_put_dummy_role2' // alias: yrn:yahoo:::tenant0:role:autotest_put_dummy_role2(not exist)
1092
+ ]);
1095
1093
 
1096
1094
  chai.request(app)
1097
1095
  .put(uri)
@@ -1130,16 +1128,14 @@ describe('API : ROLE', function(){ // eslint-disable-line no-undef
1130
1128
  });
1131
1129
 
1132
1130
  it('PUT /v1/role : failure(no token) set all new role(autotest_post_error_role1) by scoped token with status 400', function(done){ // eslint-disable-line no-undef
1133
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
1134
1131
  var uri = '/v1/role';
1135
- uri += '?name=autotest_post_error_role1'; // path: yrn:yahoo:::tenant0:role:autotest_post_error_role1
1136
- uri += '&policies=' + JSON.stringify([ // policies: yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03
1137
- 'yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03'
1138
- ]);
1139
- uri += '&alias=' + JSON.stringify([ // alias: yrn:yahoo:::tenant0:role:autotest_put_dummy_role2(not exist)
1140
- 'yrn:yahoo:::tenant0:role:autotest_put_dummy_role2'
1141
- ]);
1142
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
1132
+ uri += '?name=autotest_post_error_role1'; // path: yrn:yahoo:::tenant0:role:autotest_post_error_role1
1133
+ uri += '&policies=' + JSON.stringify([ // policies: yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03
1134
+ 'yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03'
1135
+ ]);
1136
+ uri += '&alias=' + JSON.stringify([ // alias: yrn:yahoo:::tenant0:role:autotest_put_dummy_role2(not exist)
1137
+ 'yrn:yahoo:::tenant0:role:autotest_put_dummy_role2'
1138
+ ]);
1143
1139
 
1144
1140
  chai.request(app)
1145
1141
  .put(uri)
@@ -1156,16 +1152,14 @@ describe('API : ROLE', function(){ // eslint-disable-line no-undef
1156
1152
  });
1157
1153
 
1158
1154
  it('PUT /v1/role : failure(invalid user token) set all new role(autotest_post_error_role1) by scoped token with status 401', function(done){ // eslint-disable-line no-undef
1159
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
1160
1155
  var uri = '/v1/role';
1161
- uri += '?name=autotest_post_error_role1'; // path: yrn:yahoo:::tenant0:role:autotest_post_error_role1
1162
- uri += '&policies=' + JSON.stringify([ // policies: yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03
1163
- 'yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03'
1164
- ]);
1165
- uri += '&alias=' + JSON.stringify([ // alias: yrn:yahoo:::tenant0:role:autotest_put_dummy_role2(not exist)
1166
- 'yrn:yahoo:::tenant0:role:autotest_put_dummy_role2'
1167
- ]);
1168
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
1156
+ uri += '?name=autotest_post_error_role1'; // path: yrn:yahoo:::tenant0:role:autotest_post_error_role1
1157
+ uri += '&policies=' + JSON.stringify([ // policies: yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03
1158
+ 'yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03'
1159
+ ]);
1160
+ uri += '&alias=' + JSON.stringify([ // alias: yrn:yahoo:::tenant0:role:autotest_put_dummy_role2(not exist)
1161
+ 'yrn:yahoo:::tenant0:role:autotest_put_dummy_role2'
1162
+ ]);
1169
1163
 
1170
1164
  chai.request(app)
1171
1165
  .put(uri)
@@ -1183,16 +1177,14 @@ describe('API : ROLE', function(){ // eslint-disable-line no-undef
1183
1177
  });
1184
1178
 
1185
1179
  it('PUT /v1/role : failure(invalid role token) set all new role(autotest_post_error_role1) by scoped token with status 400', function(done){ // eslint-disable-line no-undef
1186
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
1187
1180
  var uri = '/v1/role';
1188
- uri += '?name=autotest_post_error_role1'; // path: yrn:yahoo:::tenant0:role:autotest_post_error_role1
1189
- uri += '&policies=' + JSON.stringify([ // policies: yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03
1190
- 'yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03'
1191
- ]);
1192
- uri += '&alias=' + JSON.stringify([ // alias: yrn:yahoo:::tenant0:role:autotest_put_dummy_role2(not exist)
1193
- 'yrn:yahoo:::tenant0:role:autotest_put_dummy_role2'
1194
- ]);
1195
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
1181
+ uri += '?name=autotest_post_error_role1'; // path: yrn:yahoo:::tenant0:role:autotest_post_error_role1
1182
+ uri += '&policies=' + JSON.stringify([ // policies: yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03
1183
+ 'yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03'
1184
+ ]);
1185
+ uri += '&alias=' + JSON.stringify([ // alias: yrn:yahoo:::tenant0:role:autotest_put_dummy_role2(not exist)
1186
+ 'yrn:yahoo:::tenant0:role:autotest_put_dummy_role2'
1187
+ ]);
1196
1188
 
1197
1189
  chai.request(app)
1198
1190
  .put(uri)
@@ -1210,15 +1202,13 @@ describe('API : ROLE', function(){ // eslint-disable-line no-undef
1210
1202
  });
1211
1203
 
1212
1204
  it('PUT /v1/role : failure set all new role(no role name) by scoped token with status 400', function(done){ // eslint-disable-line no-undef
1213
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
1214
1205
  var uri = '/v1/role';
1215
- uri += '?policies=' + JSON.stringify([ // policies: yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03
1216
- 'yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03'
1217
- ]);
1218
- uri += '&alias=' + JSON.stringify([ // alias: yrn:yahoo:::tenant0:role:autotest_put_dummy_role2(not exist)
1219
- 'yrn:yahoo:::tenant0:role:autotest_put_dummy_role2'
1220
- ]);
1221
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
1206
+ uri += '?policies=' + JSON.stringify([ // policies: yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03
1207
+ 'yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03'
1208
+ ]);
1209
+ uri += '&alias=' + JSON.stringify([ // alias: yrn:yahoo:::tenant0:role:autotest_put_dummy_role2(not exist)
1210
+ 'yrn:yahoo:::tenant0:role:autotest_put_dummy_role2'
1211
+ ]);
1222
1212
 
1223
1213
  chai.request(app)
1224
1214
  .put(uri)
@@ -1236,16 +1226,14 @@ describe('API : ROLE', function(){ // eslint-disable-line no-undef
1236
1226
  });
1237
1227
 
1238
1228
  it('PUT /v1/role : failure(no data) set all new role(autotest_post_error_role1) by scoped token with status 400', function(done){ // eslint-disable-line no-undef
1239
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
1240
1229
  var uri = '/v1/role';
1241
- uri += '?wrong_name=autotest_post_error_role1'; // path: yrn:yahoo:::tenant0:role:autotest_post_error_role1
1242
- uri += '&wrong_policies=' + JSON.stringify([ // policies: yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03
1243
- 'yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03'
1244
- ]);
1245
- uri += '&wrong_alias=' + JSON.stringify([ // alias: yrn:yahoo:::tenant0:role:autotest_put_dummy_role2(not exist)
1246
- 'yrn:yahoo:::tenant0:role:autotest_put_dummy_role2'
1247
- ]);
1248
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
1230
+ uri += '?wrong_name=autotest_post_error_role1'; // path: yrn:yahoo:::tenant0:role:autotest_post_error_role1
1231
+ uri += '&wrong_policies=' + JSON.stringify([ // policies: yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03
1232
+ 'yrn:yahoo:::tenant0:policy:k2hr3_entest_obj_pol_03'
1233
+ ]);
1234
+ uri += '&wrong_alias=' + JSON.stringify([ // alias: yrn:yahoo:::tenant0:role:autotest_put_dummy_role2(not exist)
1235
+ 'yrn:yahoo:::tenant0:role:autotest_put_dummy_role2'
1236
+ ]);
1249
1237
 
1250
1238
  chai.request(app)
1251
1239
  .put(uri)
@@ -3078,7 +3066,7 @@ describe('API : ROLE', function(){ // eslint-disable-line no-undef
3078
3066
  expect(res.body.token).to.be.an('string').to.not.empty;
3079
3067
  expect(res.body.registerpath).to.be.an('string').to.not.empty;
3080
3068
 
3081
- ip_roletoken_tenant0_autotest_post_dummy_role1 = res.body.token; // eslint-disable-line no-unused-vars
3069
+ ip_roletoken_tenant0_autotest_post_dummy_role1 = res.body.token;
3082
3070
 
3083
3071
  done();
3084
3072
  });
@@ -3100,7 +3088,7 @@ describe('API : ROLE', function(){ // eslint-disable-line no-undef
3100
3088
  expect(res.body.token).to.be.an('string').to.not.empty;
3101
3089
  expect(res.body.registerpath).to.be.an('string').to.not.empty;
3102
3090
 
3103
- ip_roletoken_tenant0_autotest_post_dummy_role3 = res.body.token; // eslint-disable-line no-unused-vars
3091
+ ip_roletoken_tenant0_autotest_post_dummy_role3 = res.body.token;
3104
3092
 
3105
3093
  done();
3106
3094
  });
@@ -3122,7 +3110,7 @@ describe('API : ROLE', function(){ // eslint-disable-line no-undef
3122
3110
  expect(res.body.token).to.be.an('string').to.not.empty;
3123
3111
  expect(res.body.registerpath).to.be.an('string').to.not.empty;
3124
3112
 
3125
- ip_roletoken_tenant0_autotest_put_dummy_role1 = res.body.token; // eslint-disable-line no-unused-vars
3113
+ ip_roletoken_tenant0_autotest_put_dummy_role1 = res.body.token;
3126
3114
 
3127
3115
  done();
3128
3116
  });
@@ -3144,7 +3132,7 @@ describe('API : ROLE', function(){ // eslint-disable-line no-undef
3144
3132
  expect(res.body.token).to.be.an('string').to.not.empty;
3145
3133
  expect(res.body.registerpath).to.be.an('string').to.not.empty;
3146
3134
 
3147
- ip_roletoken_tenant0_autotest_put_dummy_role4 = res.body.token; // eslint-disable-line no-unused-vars
3135
+ ip_roletoken_tenant0_autotest_put_dummy_role4 = res.body.token;
3148
3136
 
3149
3137
  done();
3150
3138
  });
@@ -4717,28 +4705,28 @@ describe('API : ROLE', function(){ // eslint-disable-line no-undef
4717
4705
  expect(result).to.be.an('object');
4718
4706
  expect(result.result).to.be.a('boolean').to.be.true;
4719
4707
  expect(result.token).to.be.an('string').to.not.empty;
4720
- user_roletoken_tenant0_autotest_post_dummy_role1 = result.token; // eslint-disable-line no-unused-vars
4708
+ user_roletoken_tenant0_autotest_post_dummy_role1 = result.token;
4721
4709
 
4722
4710
  // Get user role token for yrn:yahoo:::tenant0:role:autotest_post_dummy_role3
4723
4711
  result = r3token.getRoleTokenByUser('dummyuser', 'tenant0', 'yrn:yahoo:::tenant0:role:autotest_post_dummy_role3', expire);
4724
4712
  expect(result).to.be.an('object');
4725
4713
  expect(result.result).to.be.a('boolean').to.be.true;
4726
4714
  expect(result.token).to.be.an('string').to.not.empty;
4727
- user_roletoken_tenant0_autotest_post_dummy_role3 = result.token; // eslint-disable-line no-unused-vars
4715
+ user_roletoken_tenant0_autotest_post_dummy_role3 = result.token;
4728
4716
 
4729
4717
  // Get user role token for yrn:yahoo:::tenant0:role:autotest_put_dummy_role1
4730
4718
  result = r3token.getRoleTokenByUser('dummyuser', 'tenant0', 'yrn:yahoo:::tenant0:role:autotest_put_dummy_role1', expire);
4731
4719
  expect(result).to.be.an('object');
4732
4720
  expect(result.result).to.be.a('boolean').to.be.true;
4733
4721
  expect(result.token).to.be.an('string').to.not.empty;
4734
- user_roletoken_tenant0_autotest_put_dummy_role1 = result.token; // eslint-disable-line no-unused-vars
4722
+ user_roletoken_tenant0_autotest_put_dummy_role1 = result.token;
4735
4723
 
4736
4724
  // Get user role token for yrn:yahoo:::tenant0:role:autotest_put_dummy_role4
4737
4725
  result = r3token.getRoleTokenByUser('dummyuser', 'tenant0', 'yrn:yahoo:::tenant0:role:autotest_put_dummy_role4', expire);
4738
4726
  expect(result).to.be.an('object');
4739
4727
  expect(result.result).to.be.a('boolean').to.be.true;
4740
4728
  expect(result.token).to.be.an('string').to.not.empty;
4741
- user_roletoken_tenant0_autotest_put_dummy_role4 = result.token; // eslint-disable-line no-unused-vars
4729
+ user_roletoken_tenant0_autotest_put_dummy_role4 = result.token;
4742
4730
 
4743
4731
  done();
4744
4732
  });
@@ -5546,12 +5534,10 @@ describe('API : ROLE', function(){ // eslint-disable-line no-undef
5546
5534
  // Run Test(PREPARE - CUK IP DELETE)
5547
5535
  //
5548
5536
  it('PUT /v1/role : prepare - set amin role(autotest_delhost_role) by scoped token with status 201', function(done){ // eslint-disable-line no-undef
5549
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
5550
5537
  var uri = '/v1/role';
5551
- uri += '?name=autotest_delhost_role'; // path: yrn:yahoo:::tenant0:role:autotest_delhost_role
5552
- uri += '&policies='; // policies: empty
5553
- uri += '&alias='; // alias: empty
5554
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
5538
+ uri += '?name=autotest_delhost_role'; // path: yrn:yahoo:::tenant0:role:autotest_delhost_role
5539
+ uri += '&policies='; // policies: empty
5540
+ uri += '&alias='; // alias: empty
5555
5541
 
5556
5542
  chai.request(app)
5557
5543
  .put(uri)
@@ -5630,12 +5616,10 @@ describe('API : ROLE', function(){ // eslint-disable-line no-undef
5630
5616
  });
5631
5617
 
5632
5618
  it('PUT /v1/role : prepare - set target role(autotest_del_target_role) by scoped token with status 201', function(done){ // eslint-disable-line no-undef
5633
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
5634
5619
  var uri = '/v1/role';
5635
- uri += '?name=autotest_del_target_role'; // path: yrn:yahoo:::tenant0:role:autotest_del_target_role
5636
- uri += '&policies='; // policies: empty
5637
- uri += '&alias='; // alias: empty
5638
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
5620
+ uri += '?name=autotest_del_target_role'; // path: yrn:yahoo:::tenant0:role:autotest_del_target_role
5621
+ uri += '&policies='; // policies: empty
5622
+ uri += '&alias='; // alias: empty
5639
5623
 
5640
5624
  chai.request(app)
5641
5625
  .put(uri)
@@ -59,11 +59,11 @@ while [ $# -ne 0 ]; do
59
59
  if [ -z "$1" ]; then
60
60
  break
61
61
 
62
- elif [ "$1" = "-h" ] || [ "$1" = "-H" ] || [ "$1" = "--help" ] || [ "$1" = "--HELP" ]; then
62
+ elif echo "$1" | grep -q -i -e "^-h$" -e "^--help$"; then
63
63
  PrintUsage "${PRGNAME}"
64
64
  exit 0
65
65
 
66
- elif [ "$1" = "-d" ] || [ "$1" = "-D" ] || [ "$1" = "--debuglevel" ] || [ "$1" = "--DEBUGLEVEL" ]; then
66
+ elif echo "$1" | grep -q -i -e "^-d$" -e "^--debuglevel$"; then
67
67
  if [ -n "${DEBUG_OPTION}" ]; then
68
68
  echo "[ERROR] already specified --debuglevel(-d) option"
69
69
  exit 1
@@ -74,12 +74,12 @@ while [ $# -ne 0 ]; do
74
74
  exit 1
75
75
  fi
76
76
 
77
- if [ "$1" = "dbg" ] || [ "$1" = "DBG" ] || [ "$1" = "debug" ] || [ "$1" = "DEBUG" ]; then
77
+ if echo "$1" | grep -q -i -e "^dbg$" -e "^debug$"; then
78
78
  DEBUG_ENV_DBG=1
79
79
  fi
80
80
  DEBUG_OPTION="-d $1"
81
81
 
82
- elif [ "$1" = "-a" ] || [ "$1" = "-A" ] || [ "$1" = "--async" ] || [ "$1" = "--ASYNC" ]; then
82
+ elif echo "$1" | grep -q -i -e "^-a$" -e "^--async$"; then
83
83
  if [ -n "${ASYNC_OPTION}" ]; then
84
84
  echo "[ERROR] already specified --async(-a) option"
85
85
  exit 1
@@ -70,31 +70,47 @@ describe('API : VERSION', function(){ // eslint-disable-line no-undef
70
70
  expect(res).to.have.status(200);
71
71
  expect(res).to.be.json;
72
72
 
73
- /* eslint-disable indent, no-mixed-spaces-and-tabs */
74
73
  expect(res.body).to.be.an('object').to.deep.include({
75
- 'version': { '/': ['GET'],
76
- '/v1': ['GET']},
77
- 'user token': { '/v1/user/tokens': ['HEAD', 'GET', 'POST']},
78
- 'host': { '/v1/host': ['GET', 'PUT', 'POST', 'DELETE'],
79
- '/v1/host/{port}': ['PUT', 'POST', 'DELETE'],
80
- '/v1/host/FQDN': ['DELETE'],
81
- '/v1/host/FQDN:{port}': ['DELETE'],
82
- '/v1/host/IP': ['DELETE'],
83
- '/v1/host/IP:{port}': ['DELETE']},
84
- 'service': { '/v1/service': ['PUT', 'POST'],
85
- '/v1/service/{service}': ['GET', 'HEAD', 'PUT', 'POST', 'DELETE']},
86
- 'role': { '/v1/role': ['PUT', 'POST'],
87
- '/v1/role/{role}': ['HEAD', 'GET', 'PUT', 'POST', 'DELETE'],
88
- '/v1/role/token/{role}': ['GET']},
89
- 'resource': { '/v1/resource': ['PUT', 'POST'],
90
- '/v1/resource/{resource}': ['HEAD', 'GET', 'DELETE']},
91
- 'policy': { '/v1/policy': ['PUT', 'POST'],
92
- '/v1/policy/{policy}': ['HEAD', 'GET', 'DELETE']},
93
- 'list': { '/v1/list': ['HEAD', 'GET'],
94
- '/v1/list/{role, resource, policy}/{path}': ['HEAD', 'GET']},
95
- 'acr': { '/v1/acr/{service}': ['GET', 'PUT', 'POST', 'DELETE']}
74
+ 'version': {
75
+ '/': ['GET'],
76
+ '/v1': ['GET']
77
+ },
78
+ 'user token': {
79
+ '/v1/user/tokens': ['HEAD', 'GET', 'POST']
80
+ },
81
+ 'host': {
82
+ '/v1/host': ['GET', 'PUT', 'POST', 'DELETE'],
83
+ '/v1/host/{port}': ['PUT', 'POST', 'DELETE'],
84
+ '/v1/host/FQDN': ['DELETE'],
85
+ '/v1/host/FQDN:{port}': ['DELETE'],
86
+ '/v1/host/IP': ['DELETE'],
87
+ '/v1/host/IP:{port}': ['DELETE']
88
+ },
89
+ 'service': {
90
+ '/v1/service': ['PUT', 'POST'],
91
+ '/v1/service/{service}': ['GET', 'HEAD', 'PUT', 'POST', 'DELETE']
92
+ },
93
+ 'role': {
94
+ '/v1/role': ['PUT', 'POST'],
95
+ '/v1/role/{role}': ['HEAD', 'GET', 'PUT', 'POST', 'DELETE'],
96
+ '/v1/role/token/{role}': ['GET']
97
+ },
98
+ 'resource': {
99
+ '/v1/resource': ['PUT', 'POST'],
100
+ '/v1/resource/{resource}': ['HEAD', 'GET', 'DELETE']
101
+ },
102
+ 'policy': {
103
+ '/v1/policy': ['PUT', 'POST'],
104
+ '/v1/policy/{policy}': ['HEAD', 'GET', 'DELETE']
105
+ },
106
+ 'list': {
107
+ '/v1/list': ['HEAD', 'GET'],
108
+ '/v1/list/{role, resource, policy}/{path}': ['HEAD', 'GET']
109
+ },
110
+ 'acr': {
111
+ '/v1/acr/{service}': ['GET', 'PUT', 'POST', 'DELETE']
112
+ }
96
113
  });
97
- /* eslint-enable indent, no-mixed-spaces-and-tabs */
98
114
 
99
115
  done();
100
116
  });
@@ -29,8 +29,8 @@ SRCTOP=$(cd "${SCRIPTDIR}/.." || exit 1; pwd)
29
29
  #
30
30
  # Variables
31
31
  #
32
- K2HR3_DKC_DIR=$(cd "${SRCTOP}/../k2hr3_dkc" || exit 1; pwd)
33
- K2HR3_DKC_CONF_PATH="${K2HR3_DKC_DIR}/conf"
32
+ ANTPICKAX_ETC_DIR="/etc/antpickax"
33
+ ANTPICKAX_ETC_CONF_PATH="${ANTPICKAX_ETC_DIR}"
34
34
 
35
35
  TEST_DATA_FILENAME="k2hdkc_test.data"
36
36
  TEST_DATA_TEMPLATE_FILE="${SCRIPTDIR}/${TEST_DATA_FILENAME}"
@@ -39,7 +39,7 @@ TEST_DATA_CUSTOMIZED_FILE="/tmp/${TEST_DATA_FILENAME}"
39
39
  AUTO_K2HDKC_CONF_PATH="${SRCTOP}/tests/auto_k2hdkc_slave.ini"
40
40
  AUTO_K2HDKC_CTRL_PORT=18031
41
41
 
42
- DEFAULT_REMOTE_K2HDKC_CONF_PATH="${K2HR3_DKC_CONF_PATH}/slave.ini"
42
+ DEFAULT_REMOTE_K2HDKC_CONF_PATH="${ANTPICKAX_ETC_CONF_PATH}/slave.ini"
43
43
  DEFAULT_REMOTE_K2HDKC_CTRL_PORT=8031
44
44
  DEFAULT_TENANT_MAIN="tenant0"
45
45
  DEFAULT_TENANT_SUB="tenant1"
@@ -77,18 +77,18 @@ while [ $# -ne 0 ]; do
77
77
  if [ -z "$1" ]; then
78
78
  break
79
79
 
80
- elif [ "$1" = "-h" ] || [ "$1" = "-H" ] || [ "$1" = "--help" ] || [ "$1" = "--HELP" ]; then
80
+ elif echo "$1" | grep -q -i -e "^-h$" -e "^--help$"; then
81
81
  PrintUsage "${PRGNAME}"
82
82
  exit 0
83
83
 
84
- elif [ "$1" = "-f" ] || [ "$1" = "-F" ] || [ "$1" = "--for_auto_test" ] || [ "$1" = "--FOR_AUTO_TEST" ]; then
84
+ elif echo "$1" | grep -q -i -e "^-f$" -e "^--for_auto_test$"; then
85
85
  if [ -n "${EXEC_MODE}" ]; then
86
86
  echo "[ERROR] Already specified --for_auto_test(-f) or --main(-m) or --sub(-s) option."
87
87
  exit 1
88
88
  fi
89
89
  EXEC_MODE="auto"
90
90
 
91
- elif [ "$1" = "--main" ] || [ "$1" = "--MAIN" ] || [ "$1" = "-m" ] || [ "$1" = "-M" ]; then
91
+ elif echo "$1" | grep -q -i -e "^-m$" -e "^--main$"; then
92
92
  #
93
93
  # input main tenant name
94
94
  #
@@ -108,7 +108,7 @@ while [ $# -ne 0 ]; do
108
108
  TENANT_MAIN="$1"
109
109
  EXEC_MODE="notauto"
110
110
 
111
- elif [ "$1" = "--sub" ] || [ "$1" = "--SUB" ] || [ "$1" = "-s" ] || [ "$1" = "-S" ]; then
111
+ elif echo "$1" | grep -q -i -e "^-s$" -e "^--sub$"; then
112
112
  #
113
113
  # input sub tenant name
114
114
  #
@@ -128,7 +128,7 @@ while [ $# -ne 0 ]; do
128
128
  TENANT_SUB="$1"
129
129
  EXEC_MODE="notauto"
130
130
 
131
- elif [ "$1" = "--conf" ] || [ "$1" = "--CONF" ] || [ "$1" = "-c" ] || [ "$1" = "-C" ]; then
131
+ elif echo "$1" | grep -q -i -e "^-c$" -e "^--conf$"; then
132
132
  if [ -n "${EXEC_MODE}" ] && [ "${EXEC_MODE}" = "auto" ]; then
133
133
  echo "[ERROR] --conf(-c) option is specified, but already set --for_auto_test(-f) option."
134
134
  exit 1
@@ -149,7 +149,7 @@ while [ $# -ne 0 ]; do
149
149
  REMOTE_K2HDKC_CONF_PATH="$1"
150
150
  EXEC_MODE="notauto"
151
151
 
152
- elif [ "$1" = "--port" ] || [ "$1" = "--PORT" ] || [ "$1" = "-p" ] || [ "$1" = "-P" ]; then
152
+ elif echo "$1" | grep -q -i -e "^-p$" -e "^--port$"; then
153
153
  if [ -n "${EXEC_MODE}" ] && [ "${EXEC_MODE}" = "auto" ]; then
154
154
  echo "[ERROR] --port(-p) option is specified, but already set --for_auto_test(-f) option."
155
155
  exit 1
@@ -67,18 +67,18 @@ while [ $# -ne 0 ]; do
67
67
  if [ -z "$1" ]; then
68
68
  break
69
69
 
70
- elif [ "$1" = "-h" ] || [ "$1" = "-H" ] || [ "$1" = "--help" ] || [ "$1" = "--HELP" ]; then
70
+ elif echo "$1" | grep -q -i -e "^-h$" -e "^--help$"; then
71
71
  PrintUsage "${PRGNAME}"
72
72
  exit 0
73
73
 
74
- elif [ "$1" = "-i" ] || [ "$1" = "-I" ] || [ "$1" = "--inspect" ] || [ "$1" = "--INSPECT" ]; then
74
+ elif echo "$1" | grep -q -i -e "^-i$" -e "^--inspect$"; then
75
75
  if [ "${DEBUG_USE_INSPECT}" -ne 0 ]; then
76
76
  echo "[ERROR] Already specified --inspect(-i) option"
77
77
  exit 1
78
78
  fi
79
79
  DEBUG_USE_INSPECT=1
80
80
 
81
- elif [ "$1" = "-d" ] || [ "$1" = "-D" ] || [ "$1" = "--debuglevel" ] || [ "$1" = "--DEBUGLEVEL" ]; then
81
+ elif echo "$1" | grep -q -i -e "^-d$" -e "^--debuglevel$"; then
82
82
  #
83
83
  # DEBUG option
84
84
  #
@@ -87,25 +87,25 @@ while [ $# -ne 0 ]; do
87
87
  echo "[ERROR] --debuglevel(-dl) option needs parameter(dbg/msg/warn/err/custom debug level)"
88
88
  exit 1
89
89
  fi
90
- if [ "$1" = "dbg" ] || [ "$1" = "DBG" ] || [ "$1" = "debug" ] || [ "$1" = "DEBUG" ]; then
90
+ if echo "$1" | grep -q -i -e "^dbg$" -e "^debug$"; then
91
91
  if [ "${DEBUG_ENV_LEVEL}" -ne 0 ]; then
92
92
  echo "[ERROR] --debuglevel(-dl) option already is set"
93
93
  exit 1
94
94
  fi
95
95
  DEBUG_ENV_LEVEL=4
96
- elif [ "$1" = "msg" ] || [ "$1" = "MSG" ] || [ "$1" = "message" ] || [ "$1" = "MESSAGE" ] || [ "$1" = "info" ] || [ "$1" = "INFO" ]; then
96
+ elif echo "$1" | grep -q -i -e "^msg$" -e "^message$" -e "^info$"; then
97
97
  if [ "${DEBUG_ENV_LEVEL}" -ne 0 ]; then
98
98
  echo "[ERROR] --debuglevel(-dl) option already is set"
99
99
  exit 1
100
100
  fi
101
101
  DEBUG_ENV_LEVEL=3
102
- elif [ "$1" = "warn" ] || [ "$1" = "WARN" ] || [ "$1" = "warning" ] || [ "$1" = "WARNING" ]; then
102
+ elif echo "$1" | grep -q -i -e "^wan$" -e "^warn$" -e "^warning$"; then
103
103
  if [ "${DEBUG_ENV_LEVEL}" -ne 0 ]; then
104
104
  echo "[ERROR] --debuglevel(-dl) option already is set"
105
105
  exit 1
106
106
  fi
107
107
  DEBUG_ENV_LEVEL=2
108
- elif [ "$1" = "err" ] || [ "$1" = "ERR" ] || [ "$1" = "error" ] || [ "$1" = "ERROR" ]; then
108
+ elif echo "$1" | grep -q -i -e "^err$" -e "^error$"; then
109
109
  if [ "${DEBUG_ENV_LEVEL}" -ne 0 ]; then
110
110
  echo "[ERROR] --debuglevel(-dl) option already is set"
111
111
  exit 1
@@ -121,7 +121,7 @@ while [ $# -ne 0 ]; do
121
121
  DEBUG_ENV_CUSTOM="${DEBUG_ENV_CUSTOM}$1"
122
122
  fi
123
123
 
124
- elif [ "$1" = "-v" ] || [ "$1" = "-V" ] || [ "$1" = "--varlist" ] || [ "$1" = "--VARLIST" ]; then
124
+ elif echo "$1" | grep -q -i -e "^-v$" -e "^--varlist$"; then
125
125
  #
126
126
  # input variable list file path
127
127
  #
@@ -140,7 +140,7 @@ while [ $# -ne 0 ]; do
140
140
  fi
141
141
  INPUT_VARFILE="$1"
142
142
 
143
- elif [ "$1" = "-t" ] || [ "$1" = "-T" ] || [ "$1" = "--templ" ] || [ "$1" = "--TEMPL" ] || [ "$1" = "--template" ] || [ "$1" = "--TEMPLATE" ]; then
143
+ elif echo "$1" | grep -q -i -e "^-t$" -e "^--templ$" -e "^--template$"; then
144
144
  #
145
145
  # input template file path
146
146
  #
@@ -163,7 +163,7 @@ while [ $# -ne 0 ]; do
163
163
  fi
164
164
  INPUT_TEMPLFILE="$1"
165
165
 
166
- elif [ "$1" = "-s" ] || [ "$1" = "-S" ] || [ "$1" = "--str" ] || [ "$1" = "--STR" ] || [ "$1" = "--string" ] || [ "$1" = "--STRING" ]; then
166
+ elif echo "$1" | grep -q -i -e "^-s$" -e "^--str$" -e "^--string$"; then
167
167
  #
168
168
  # input template string
169
169
  #
@@ -182,7 +182,7 @@ while [ $# -ne 0 ]; do
182
182
  fi
183
183
  INPUT_TEMPLSTR="$1"
184
184
 
185
- elif [ "$1" = "-a" ] || [ "$1" = "-A" ] || [ "$1" = "--async" ] || [ "$1" = "--ASYNC" ]; then
185
+ elif echo "$1" | grep -q -i -e "^-a$" -e "^--async$"; then
186
186
  #
187
187
  # async mode
188
188
  #
@@ -271,7 +271,7 @@ if [ -z "${INPUT_TEMPLFILE}" ]; then
271
271
  printf '> '
272
272
  read -r TEMPLLINE
273
273
 
274
- if [ "${TEMPLLINE}" = "EOF" ] || [ "${TEMPLLINE}" = "eof" ]; then
274
+ if echo "${TEMPLLINE}" | grep -q -i "^eof$"; then
275
275
  IS_EOF=1
276
276
  else
277
277
  echo "${TEMPLLINE}" >> "${INPUT_TEMPLFILE}"