Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
A
Aruba-Master
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Aruba-Master
Commits
9b1ab22d
Commit
9b1ab22d
authored
Apr 18, 2020
by
Ahmad Nemati
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
init
parent
0f52ecbf
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
29 additions
and
8 deletions
+29
-8
aruba.js
aruba.js
+29
-7
test.js
test.js
+0
-1
No files found.
aruba.js
View file @
9b1ab22d
...
...
@@ -9,9 +9,10 @@ let networkId
let
serverId
let
initData
=
false
//ini
t()
tes
t
()
async
function
test
()
{
masterIp
=
'
195.231.67.55
'
for
(
let
i
=
0
;
i
<
AvailDc
.
length
;
i
++
)
{
let
servers
=
await
getAllServers
(
AvailDc
[
i
])
...
...
@@ -42,6 +43,9 @@ async function test() {
console
.
log
(
'
networkId ->
'
+
networkId
)
console
.
log
(
'
serverId ->
'
+
serverId
)
let
a
=
await
RemovedByIp
(
'
195.231.67.35
'
)
console
.
log
(
a
)
}
...
...
@@ -101,6 +105,7 @@ async function getDetailsofServer(dc, id) {
}
async
function
createFloatingIp
()
{
let
ips
=
await
getAllIps
()
let
url
=
generateUrl
(
foundDc
,
'
SetPurchaseIpAddress
'
)
let
d
=
await
doRequest
(
url
,
auth
)
...
...
@@ -123,6 +128,16 @@ async function getAllIps() {
return
arr
}
async
function
canAddFloatingIp
()
{
let
ips
=
await
getAllIps
()
let
count
=
0
for
(
let
i
=
0
;
i
<
ips
.
length
;
i
++
)
{
}
}
async
function
deleteAllIps
()
{
...
...
@@ -175,6 +190,7 @@ async function attachedToServerByIp(ip) {
for
(
let
i
=
0
;
i
<
ips
.
length
;
i
++
)
{
if
(
ips
[
i
].
Value
===
ip
)
{
console
.
log
(
ips
[
i
])
await
attachedToServer
(
foundDc
,
ips
[
i
].
ResourceId
)
break
}
...
...
@@ -192,19 +208,25 @@ async function RemovedByIp(ip) {
for
(
let
i
=
0
;
i
<
ips
.
length
;
i
++
)
{
if
(
ips
[
i
].
Value
===
ip
&&
ip
!==
masterIp
)
{
await
deleteIp
(
foundDc
,
ips
[
i
].
ResourceId
)
break
return
await
deleteIp
(
foundDc
,
ips
[
i
].
ResourceId
)
}
}
return
'
Done
'
}
async
function
deleteIp
(
id
)
{
await
unAttachedToServer
(
foundDc
,
id
)
try
{
await
unAttachedToServer
(
foundDc
,
id
)
}
catch
(
e
)
{
}
let
url
=
generateUrl
(
foundDc
,
'
SetRemoveIpAddress
'
)
let
body
=
auth
body
.
IpAddressResourceId
=
id
...
...
@@ -238,8 +260,8 @@ async function doRequest(url, body) {
if
(
error
)
reject
(
'
Problem ->
'
+
options
.
url
)
try
{
console
.
log
(
url
)
console
.
log
(
body
)
resolve
(
JSON
.
parse
(
body
))
}
catch
(
e
)
{
...
...
test.js
View file @
9b1ab22d
console
.
log
(
ip
)
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment