HewlettPackard/servicenow-oneview

Name: servicenow-oneview

Owner: Hewlett Packard Enterprise

Description: null

Created: 2017-04-20 15:31:30.0

Updated: 2017-09-03 13:31:54.0

Pushed: 2017-12-07 10:38:34.0

Homepage: null

Size: 616

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

HPE OneView to Service-Now Integration

The code within this repository builds an integration between HPE OneView and an instance of Service NOW.

The following use cases are supported by this integration.

Use case #1: Incident management
Use case #2: Configuration management
Use case #3: Service catalog offering
Pre-requisites ( Software dependancies to run this integration )
Build Instructions (How to setup )
  1. clone the repo onto your PC or VM
  2. cd to servicenow-oneview directory
  3. run “npm install” command to install javascript dependent modules.
  4. If elasticsearch instance is running on localhost, no need to update the esPersistance.js else update the esPersistance.js for IP address/hostname of elasticsearch.
  5. configure MID server with your servicenow instance and start the service
  6. Define outbound REST message APIs on servicenow instance to communicate with integration pack instance. Here are the high level steps:
    • login to your servicenow instance, then go to outbound REST message.
    • Let us create 3 REST message APIs as shown in the below picture.
    • Sample REST Message APIs -POST :3000/arrow/v1/incident
      sample playload and headers are in the below picture
      ![Sample POST /arrow/v1/incident](https://github.com/HewlettPackard/servicenow-oneview/blob/master/images/REST_POST_ALERT_%20ServiceNow.png)
      
      -POST :3000/arrow/v1/login-sessions
      sample playload and headers are in the below picture
      ![Sample POST /arrow/v1/login-sessions](https://github.com/HewlettPackard/servicenow-oneview/blob/master/images/REST_POST_LOGIN-SESSIONS_%20ServiceNow.png)
      
      -POST :3000/arrow/v1/provision-server
      sample playload and headers are in the below picture
      ![Sample POST /arrow/v1/provision-server](https://github.com/HewlettPackard/servicenow-oneview/blob/master/images/REST_POST_SERVER_PROVISION_%20ServiceNow.png)
      
  7. configure business rules on the incidents. You can copy business rule code from ServiceNow/incidents_business_rules.txt and edit IP address and MID server name. The rule will execute when user closes incident on server. This rule makes REST call to integration server and then active alert on oneview would get closed.
  8. create workflow design with custom run script. You can copy custom workflow runscript code from ServiceNow/workflow-script.txt and edit the IP address and MID server name. The sample workflow will get executed when requested service catalog item is approved. Here is sample workflow design. Sample Workflow Design
  9. Edit servicenow-oneview/arguments.json with your servicenow instance credentials
How to run the application
  1. start the elasticsearch instance
  2. cd to servicenow-oneview, run “node server.js | ./node_modules/.bin/bunyan” command to start the nodejs server
  3. check the trap list file (.csv ) in in ./scripts/traps folder. This csv file is being read and alerts are filtered based on this list
  4. cd to servicenow-oneview/scripts and run scmb python script with below command

    python3 ovincidents.py -i “path to arguments.json”

How to test and troubleshoot
Use Case #1
1. Simulate or generate "active" alert on oneview
2. You should see an new incidents on servicenow ( if incident already exists, it updated with new alert. One incident per server hardware ). Depending on the filtered trap list, you will alerts landing in Incident table or events table.
3. If you close an incident in servicenow, the alert will be cleared on oneview
4. Review arrow.log and OVSB.log for additional troubleshooting ( if you run into any issues )
Use Case #3
1. Request physical server service catalog from your request catalog
2. Approve the request
3. You should see bare metal server getting provisioned in OneView
Note: Before runnig this use case, you should configure REST message endpoints and should do basic testing to make sure your         connections and endpoints are working
Use Case #2
1. For running configuration management use case, you should have prior knowledge of ServiceNow CDMB records and uploading CMDB records either using csv file or some othe mechanism.
2. run scripts/load_ci_items.py script to get servers list from OneView and store into csv file
3. Follow ServiceNow steps to load csv file onto CMDB records table
4. Run scripts/synchw.py through Run deck software or manually for ondemand sync'ing between OneView and CMDB records
5. After running the above scripts, records in CMDB should be updated. Script updates 'os_version' and 'os_domain' fields of CMDB CI table. This marks the server and becomes unavailable for service request
Assumptions
  1. Initial HPE servers records should be created in the ServiceNow CMDB
  2. Service catalog request offering should be created for running use case # 2
  3. Optionally configure the run deck to run the sync script automatically
  4. Image Streamer feature is used for OS provisioning

This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.