Initial Commit for ODTN demo repo with demo scripts and demo app

Change-Id: I812c9fbe7a4b5d454038860acbb936fa9b189438
diff --git a/odtn-phase1-demo/src/App.css b/odtn-phase1-demo/src/App.css
new file mode 100644
index 0000000..dffd813
--- /dev/null
+++ b/odtn-phase1-demo/src/App.css
@@ -0,0 +1,36 @@
+.App {
+  text-align: center;
+}
+
+.App-logo {
+  height: 10vmin;
+}
+
+.App-header {
+  background-color: #282c34;
+  min-height: 20vh;
+  display: flex;
+  flex-direction: column;
+  align-items: center;
+  justify-content: center;
+  font-size: 20px;
+  color: white;
+}
+
+.App-link {
+  color: #61dafb;
+}
+
+@keyframes App-logo-spin {
+  from {
+    transform: rotate(0deg);
+  }
+  to {
+    transform: rotate(360deg);
+  }
+
+}
+
+.odtn-graph {
+  height: 12vh;
+}
\ No newline at end of file
diff --git a/odtn-phase1-demo/src/App.js b/odtn-phase1-demo/src/App.js
new file mode 100644
index 0000000..0bd12cd
--- /dev/null
+++ b/odtn-phase1-demo/src/App.js
@@ -0,0 +1,507 @@
+import green from '@material-ui/core/colors/green'
+import red from '@material-ui/core/colors/red'
+import {
+  Button,
+  FormControl,
+  Grid,
+  Icon,
+  InputLabel,
+  MenuItem,
+  Select,
+  Snackbar,
+  SnackbarContent,
+} from '@material-ui/core/es/index'
+import SendIcon from '@material-ui/icons/Send'
+import DeleteIcon from '@material-ui/icons/Delete'
+import withStyles from '@material-ui/core/es/styles/withStyles'
+import React, {
+  Component,
+  createRef,
+} from 'react';
+import {
+  Network,
+  DataSet,
+} from 'vis'
+import onos from './onos.png'
+import './App.css';
+import {
+  createConnectivityService,
+  deleteConnectivityServices,
+} from './resources/dcs'
+import { getResources } from './resources/getResources'
+import { range } from 'lodash'
+
+
+const INTERVAL = 10000
+
+const GRAPH_OPTION = {
+  // edges: {
+  //   smooth: true,
+  // },
+}
+
+const SPACE = {
+  v: 15,
+  h: 100,
+}
+
+const DEBUG = false
+
+const styles = theme => ( {
+  root: {
+    flexGrow: 1,
+  },
+  main: {
+    marginTop: '20px',
+    padding: '10px',
+    border: '0.5px solid  #666666',
+  },
+  form: {
+    minWidth: 120,
+    display: 'flex',
+    flexWrap: 'wrap',
+  },
+  button: {
+    margin: theme.spacing.unit,
+  },
+  leftIcon: {
+    marginRight: theme.spacing.unit,
+  },
+  rightIcon: {
+    marginLeft: theme.spacing.unit,
+  },
+} )
+
+
+class App extends Component {
+
+  constructor( props ) {
+    super()
+    this.state = {
+      connectivityServices: [],
+      devices: [],
+      network: {},
+      request: {
+        left: '',
+        right: '',
+      },
+      message: '',
+      messageColor: green[ 600 ],
+      open: false,
+    }
+    this.appRefList = range( 8 ).map( () => createRef() )
+  }
+
+  componentDidMount = () => {
+    this.updateResource()
+    setTimeout( this.updateResource, 100 )
+    setInterval( this.updateResource, INTERVAL )
+  }
+
+  updateResource = () => {
+    getResources().then( ( [ devices, connectivityServices ] ) => {
+      console.log( connectivityServices )
+      const portMap = this.getPortMap( devices )
+      const network = Object.values( portMap ).map( this.setupGraph )
+      this.setState( {
+        devices,
+        network,
+        connectivityServices,
+      } )
+    } )
+  }
+
+  getPortMap = ( devices ) => {
+    const portMap = {}
+    range( 8 ).forEach( idx => portMap[ idx ] = [] )
+
+    devices.forEach( ( device, deviceIdx ) => {
+      device.ports.forEach( port => {
+        const re = /\[\d*\]\((\d*)\)/
+        const portNum = re.exec( port.port )[ 1 ]
+        const lineNum = Math.floor( ( portNum - 1 ) % 100 / 2 )
+
+        port.id = `${port.element}/${portNum}`
+        port.portNum = portNum
+        port.isClient = Math.floor( portNum / 100 ) === 1
+        port.isLeft = deviceIdx === 0
+        port.color = !port.isClient ? '#888888' : deviceIdx === 0 ? '#DD8800' : '#0088DD'
+        port.isEven = port.portNum % 2 === 0
+
+        portMap[ lineNum ].push( port )
+      } )
+    } )
+
+    return portMap
+  }
+
+  getAssociatedConnectivity = ( uuid ) => {
+    let oppositePortUuid = null
+    let connectivitySrv = null
+    this.state.connectivityServices.forEach( srv => {
+      let isTarget = false
+      srv[ 'end-point' ].forEach( ep => {
+        const epUuid = ep[ 'service-interface-point' ][ 'service-interface-point-uuid' ]
+        if ( uuid === epUuid ) {
+          connectivitySrv = srv
+          isTarget = true
+        }
+      } )
+      if ( isTarget ) {
+        oppositePortUuid = srv[ 'end-point' ].filter( ep => {
+          const epUuid = ep[ 'service-interface-point' ][ 'service-interface-point-uuid' ]
+          return epUuid !== uuid
+        } )[ 0 ][ 'service-interface-point' ][ 'service-interface-point-uuid' ]
+      }
+    } )
+    return [ connectivitySrv, oppositePortUuid ]
+  }
+
+  checkRequest = ( leftUuid, rightUuid ) => {
+    const portMap = this.getPortMap( this.state.devices )
+
+    const getPosition = ( uuid ) => {
+      let position = null
+      Object.entries( portMap ).forEach( ( [ idx, ports ] ) => {
+        const exist = ports.filter( port => port.sipId === uuid ).length === 1
+        if ( exist ) {
+          position = idx
+        }
+      } )
+      if ( position === null ) {
+        throw Error( 'Port not found' )
+      }
+      return position
+    }
+
+    if ( getPosition( leftUuid ) !== getPosition( rightUuid ) ) {
+      throw Error( 'Invalid request' )
+    }
+  }
+
+  setupGraph = ( ports, idx ) => {
+
+    // predefined port
+    const nodes = ports
+      .filter( port => port.isClient || !port.isEven )
+      .map( port => {
+        const [ x, y ] = getPosition( port )
+        return {
+          id: port.id,
+          label: port.isClient ? port.portNum : '',
+          x,
+          y,
+          shape: 'ellipse',
+          size: 20,
+          color: port.color,
+          physics: false,
+          // font: '20px',
+        }
+      } )
+
+    // predefined line
+    const edgeMap = {}
+    ports.forEach( port => {
+      if ( port.isClient ) {
+        return
+      }
+      edgeMap[ port.portNum ] = edgeMap[ port.portNum ] || {}
+      if ( port.isLeft ) {
+        edgeMap[ port.portNum ].from = port.id
+      } else {
+        edgeMap[ port.portNum ].to = port.id
+      }
+      edgeMap[ port.portNum ].label = 'optical line'
+    } )
+    const externalEdges = Object.values( edgeMap )
+
+    // existing connectivity service
+    const internalEdges = []
+    ports.forEach( port => {
+      if ( !port.isClient ) {
+        return
+      }
+      if ( !port.isLeft ) {
+        return
+      }
+
+      const [ connectivitySrv, oppositePortUuid ] = this.getAssociatedConnectivity( port.sipId )
+      if ( !connectivitySrv ) {
+        return
+      }
+      const oppositePort = ports.filter( port => port.sipId === oppositePortUuid )[ 0 ]
+
+      console.log( ports.filter( _port => !_port.isClient && _port.element === port.element ) )
+      console.log( ports.filter( _port => !_port.isClient && _port.element === oppositePort.element ) )
+      internalEdges.push( {
+        from: port.id,
+        to: ports.filter( _port => !_port.isClient && _port.element === port.element )[ 0 ].id,
+      } )
+
+      internalEdges.push( {
+        from: oppositePort.id,
+        to: ports.filter( _port => !_port.isClient && _port.element === oppositePort.element )[ 0 ].id,
+      } )
+    } )
+
+    const edges = externalEdges.concat( internalEdges )
+
+    const data = {
+      nodes: new DataSet( nodes ),
+      edges: new DataSet( edges ),
+    }
+    return new Network( this.appRefList[ idx ].current, data, GRAPH_OPTION )
+  }
+
+  handleChange = ( ev ) => {
+    if ( ev.target.name === 'left' ) {
+      const request = Object.assign( {}, this.state.request, {
+        left: ev.target.value,
+      } )
+      this.setState( {
+        request,
+      } )
+    } else {
+      const request = Object.assign( {}, this.state.request, {
+        right: ev.target.value,
+      } )
+      this.setState( {
+        request,
+      } )
+    }
+  }
+
+  handleCreate = () => {
+    const { left, right } = this.state.request
+    try {
+      this.checkRequest( left, right )
+    }catch(err){
+      this.setState( {
+        message: err.message,
+        messageColor: red[ 600 ],
+      } )
+      return
+    }
+
+    createConnectivityService( left, right )
+      .then( json => {
+        const message = DEBUG ? JSON.stringify( json ) : 'Create ConnectivityService completed.'
+        this.setState( {
+          message,
+          messageColor: green[ 600 ],
+        } )
+        setTimeout( this.updateResource, 1000 )
+      } )
+      .catch( err => {
+        console.error( err )
+        this.setState( {
+          message: 'Error',
+          messageColor: red[ 600 ],
+        } )
+      } )
+  }
+
+  handleDelete = () => {
+    const { left, right } = this.state.request
+    try {
+      this.checkRequest( left, right )
+    }catch(err){
+      this.setState( {
+        message: err.message,
+        messageColor: red[ 600 ],
+      } )
+      return
+    }
+
+    const [ connectivitySrv, clientPortUuid ] = this.getAssociatedConnectivity( left )
+    if ( clientPortUuid !== right ) {
+      const message = 'Connectivity Service not found.'
+      this.setState( {
+        message,
+      } )
+      return
+    }
+    deleteConnectivityServices( connectivitySrv.uuid )
+      .then( json => {
+        const message = 'Delete ConnectivityService completed.'
+        this.setState( {
+          message,
+          messageColor: green[ 600 ],
+        } )
+        setTimeout( this.updateResource, 1000 )
+      } )
+      .catch( err => {
+        console.error( err )
+        this.setState( {
+          message: 'Error',
+          messageColor: red[ 600 ],
+        } )
+      } )
+  }
+
+  handleSnackClose = () => {
+    this.setState( {
+      message: '',
+    } )
+  }
+
+
+  render() {
+
+    const { classes } = this.props
+
+    const { devices } = this.state
+
+    const leftSipPorts = devices[ 0 ] ? devices[ 0 ].ports.filter( port => port.sipId ) : []
+    const rightSipPorts = devices[ 1 ] ? devices[ 1 ].ports.filter( port => port.sipId ) : []
+
+    return (
+      <div className="App">
+        <header className="App-header">
+          <img src={ onos } className="App-logo" alt="logo"/>
+          <p>
+            ODTN sample app
+          </p>
+        </header>
+        <Grid container className={ classes.root } spacing={ 24 }>
+          <Grid item xs={ 2 }/>
+          <Grid item container xs={ 8 } spacing={ 24 }>
+            <Grid item xs={ 4 }>
+              <form>
+                <FormControl className={ classes.form }>
+                  <InputLabel>Client Port 1</InputLabel>
+                  <Select value={ this.state.request.left }
+                          onChange={ this.handleChange }
+                          inputProps={ {
+                            name: 'left',
+                            id: 'left',
+                          } }>
+                    {
+                      leftSipPorts.map( port => (
+                        <MenuItem key={ port.id } value={ port.sipId }>{ port.id }</MenuItem>
+                      ) )
+                    }
+                  </Select>
+                </FormControl>
+              </form>
+            </Grid>
+            <Grid item xs={ 4 }>
+              <form>
+                <FormControl className={ classes.form }>
+                  <InputLabel>Client Port 2</InputLabel>
+                  <Select value={ this.state.request.right }
+                          onChange={ this.handleChange }
+                          inputProps={ {
+                            name: 'right',
+                            id: 'right',
+                          } }>
+                    {
+                      rightSipPorts.map( port => (
+                        <MenuItem key={ port.id } value={ port.sipId }>{ port.id }</MenuItem>
+                      ) )
+                    }
+                  </Select>
+                </FormControl>
+              </form>
+            </Grid>
+
+            <Grid item xs={ 2 }>
+              <Button variant="contained" className={ classes.button } onClick={ this.handleCreate }>
+                Create
+                { /* This Button uses a Font Icon, see the installation instructions in the docs. */ }
+                <SendIcon className={ classes.rightIcon }/>
+              </Button>
+            </Grid>
+
+            <Grid item xs={ 2 }>
+              <Button variant="contained" className={ classes.button } onClick={ this.handleDelete }>
+                Delete
+                { /* This Button uses a Font Icon, see the installation instructions in the docs. */ }
+                <DeleteIcon className={ classes.rightIcon }/>
+              </Button>
+            </Grid>
+
+            <Grid item className={ classes.main } container xs={ 12 } spacing={ 24 }>
+              <Grid item xs={ 1 }/>
+              <Grid item xs={ 5 }>
+                <p>Cassini 1</p>
+                <p>{ devices[ 0 ] ? devices[ 0 ].id : '' }</p>
+              </Grid>
+              <Grid item xs={ 5 }>
+                <p>Cassini 2</p>
+                <p>{ devices[ 1 ] ? devices[ 1 ].id : '' }</p>
+              </Grid>
+              <Grid item xs={ 1 }/>
+              {
+                this.appRefList.map( ( appRef, idx ) => (
+                  <Grid item xs={ 12 }>
+                    <div className="odtn-graph" key={ `vis${idx}` } ref={ appRef }/>
+                  </Grid>
+                ) )
+              }
+            </Grid>
+
+          </Grid>
+
+          <Grid item xs={ 2 }/>
+        </Grid>
+        <Snackbar
+          anchorOrigin={ {
+            vertical: 'top',
+            horizontal: 'right',
+          } }
+          open={ Boolean( this.state.message ) }
+          autoHideDuration={ 4000 }
+          onClose={ this.handleSnackClose }
+          ContentProps={ {
+            'aria-describedby': 'message-id',
+          } }
+        >
+          <SnackbarContent
+            style={ { backgroundColor: this.state.messageColor } }
+            message={ this.state.message }
+          />
+        </Snackbar>
+      </div>
+
+    );
+  }
+}
+
+export default withStyles( styles )( App );
+
+
+function getPosition( port ) {
+  const { v, h } = SPACE
+  if ( port.isClient ) {
+    if ( port.isLeft ) {
+      if ( port.isEven ) {
+        return [ h * -3, v * 1.5 ]
+      } else {
+        return [ h * -3, v * -1.5 ]
+      }
+    } else {
+      if ( port.isEven ) {
+        return [ h * 3, v * 1.5 ]
+      } else {
+        return [ h * 3, v * -1.5 ]
+      }
+    }
+
+  } else {
+    if ( port.isLeft ) {
+      if ( port.isEven ) {
+        return [ h * -1, v ]
+      } else {
+        return [ h * -1, v * -1 ]
+      }
+    }
+    else {
+      if ( port.isEven ) {
+        return [ h, v ]
+      } else {
+        return [ h, v * -1 ]
+      }
+    }
+  }
+}
\ No newline at end of file
diff --git a/odtn-phase1-demo/src/App.test.js b/odtn-phase1-demo/src/App.test.js
new file mode 100644
index 0000000..a754b20
--- /dev/null
+++ b/odtn-phase1-demo/src/App.test.js
@@ -0,0 +1,9 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import App from './App';
+
+it('renders without crashing', () => {
+  const div = document.createElement('div');
+  ReactDOM.render(<App />, div);
+  ReactDOM.unmountComponentAtNode(div);
+});
diff --git a/odtn-phase1-demo/src/index.css b/odtn-phase1-demo/src/index.css
new file mode 100644
index 0000000..cee5f34
--- /dev/null
+++ b/odtn-phase1-demo/src/index.css
@@ -0,0 +1,14 @@
+body {
+  margin: 0;
+  padding: 0;
+  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Roboto", "Oxygen",
+    "Ubuntu", "Cantarell", "Fira Sans", "Droid Sans", "Helvetica Neue",
+    sans-serif;
+  -webkit-font-smoothing: antialiased;
+  -moz-osx-font-smoothing: grayscale;
+}
+
+code {
+  font-family: source-code-pro, Menlo, Monaco, Consolas, "Courier New",
+    monospace;
+}
diff --git a/odtn-phase1-demo/src/index.js b/odtn-phase1-demo/src/index.js
new file mode 100644
index 0000000..0c5e75d
--- /dev/null
+++ b/odtn-phase1-demo/src/index.js
@@ -0,0 +1,12 @@
+import React from 'react';
+import ReactDOM from 'react-dom';
+import './index.css';
+import App from './App';
+import * as serviceWorker from './serviceWorker';
+
+ReactDOM.render(<App />, document.getElementById('root'));
+
+// If you want your app to work offline and load faster, you can change
+// unregister() to register() below. Note this comes with some pitfalls.
+// Learn more about service workers: http://bit.ly/CRA-PWA
+serviceWorker.unregister();
diff --git a/odtn-phase1-demo/src/logo.svg b/odtn-phase1-demo/src/logo.svg
new file mode 100644
index 0000000..6b60c10
--- /dev/null
+++ b/odtn-phase1-demo/src/logo.svg
@@ -0,0 +1,7 @@
+<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 841.9 595.3">
+    <g fill="#61DAFB">
+        <path d="M666.3 296.5c0-32.5-40.7-63.3-103.1-82.4 14.4-63.6 8-114.2-20.2-130.4-6.5-3.8-14.1-5.6-22.4-5.6v22.3c4.6 0 8.3.9 11.4 2.6 13.6 7.8 19.5 37.5 14.9 75.7-1.1 9.4-2.9 19.3-5.1 29.4-19.6-4.8-41-8.5-63.5-10.9-13.5-18.5-27.5-35.3-41.6-50 32.6-30.3 63.2-46.9 84-46.9V78c-27.5 0-63.5 19.6-99.9 53.6-36.4-33.8-72.4-53.2-99.9-53.2v22.3c20.7 0 51.4 16.5 84 46.6-14 14.7-28 31.4-41.3 49.9-22.6 2.4-44 6.1-63.6 11-2.3-10-4-19.7-5.2-29-4.7-38.2 1.1-67.9 14.6-75.8 3-1.8 6.9-2.6 11.5-2.6V78.5c-8.4 0-16 1.8-22.6 5.6-28.1 16.2-34.4 66.7-19.9 130.1-62.2 19.2-102.7 49.9-102.7 82.3 0 32.5 40.7 63.3 103.1 82.4-14.4 63.6-8 114.2 20.2 130.4 6.5 3.8 14.1 5.6 22.5 5.6 27.5 0 63.5-19.6 99.9-53.6 36.4 33.8 72.4 53.2 99.9 53.2 8.4 0 16-1.8 22.6-5.6 28.1-16.2 34.4-66.7 19.9-130.1 62-19.1 102.5-49.9 102.5-82.3zm-130.2-66.7c-3.7 12.9-8.3 26.2-13.5 39.5-4.1-8-8.4-16-13.1-24-4.6-8-9.5-15.8-14.4-23.4 14.2 2.1 27.9 4.7 41 7.9zm-45.8 106.5c-7.8 13.5-15.8 26.3-24.1 38.2-14.9 1.3-30 2-45.2 2-15.1 0-30.2-.7-45-1.9-8.3-11.9-16.4-24.6-24.2-38-7.6-13.1-14.5-26.4-20.8-39.8 6.2-13.4 13.2-26.8 20.7-39.9 7.8-13.5 15.8-26.3 24.1-38.2 14.9-1.3 30-2 45.2-2 15.1 0 30.2.7 45 1.9 8.3 11.9 16.4 24.6 24.2 38 7.6 13.1 14.5 26.4 20.8 39.8-6.3 13.4-13.2 26.8-20.7 39.9zm32.3-13c5.4 13.4 10 26.8 13.8 39.8-13.1 3.2-26.9 5.9-41.2 8 4.9-7.7 9.8-15.6 14.4-23.7 4.6-8 8.9-16.1 13-24.1zM421.2 430c-9.3-9.6-18.6-20.3-27.8-32 9 .4 18.2.7 27.5.7 9.4 0 18.7-.2 27.8-.7-9 11.7-18.3 22.4-27.5 32zm-74.4-58.9c-14.2-2.1-27.9-4.7-41-7.9 3.7-12.9 8.3-26.2 13.5-39.5 4.1 8 8.4 16 13.1 24 4.7 8 9.5 15.8 14.4 23.4zM420.7 163c9.3 9.6 18.6 20.3 27.8 32-9-.4-18.2-.7-27.5-.7-9.4 0-18.7.2-27.8.7 9-11.7 18.3-22.4 27.5-32zm-74 58.9c-4.9 7.7-9.8 15.6-14.4 23.7-4.6 8-8.9 16-13 24-5.4-13.4-10-26.8-13.8-39.8 13.1-3.1 26.9-5.8 41.2-7.9zm-90.5 125.2c-35.4-15.1-58.3-34.9-58.3-50.6 0-15.7 22.9-35.6 58.3-50.6 8.6-3.7 18-7 27.7-10.1 5.7 19.6 13.2 40 22.5 60.9-9.2 20.8-16.6 41.1-22.2 60.6-9.9-3.1-19.3-6.5-28-10.2zM310 490c-13.6-7.8-19.5-37.5-14.9-75.7 1.1-9.4 2.9-19.3 5.1-29.4 19.6 4.8 41 8.5 63.5 10.9 13.5 18.5 27.5 35.3 41.6 50-32.6 30.3-63.2 46.9-84 46.9-4.5-.1-8.3-1-11.3-2.7zm237.2-76.2c4.7 38.2-1.1 67.9-14.6 75.8-3 1.8-6.9 2.6-11.5 2.6-20.7 0-51.4-16.5-84-46.6 14-14.7 28-31.4 41.3-49.9 22.6-2.4 44-6.1 63.6-11 2.3 10.1 4.1 19.8 5.2 29.1zm38.5-66.7c-8.6 3.7-18 7-27.7 10.1-5.7-19.6-13.2-40-22.5-60.9 9.2-20.8 16.6-41.1 22.2-60.6 9.9 3.1 19.3 6.5 28.1 10.2 35.4 15.1 58.3 34.9 58.3 50.6-.1 15.7-23 35.6-58.4 50.6zM320.8 78.4z"/>
+        <circle cx="420.9" cy="296.5" r="45.7"/>
+        <path d="M520.5 78.1z"/>
+    </g>
+</svg>
diff --git a/odtn-phase1-demo/src/onos.png b/odtn-phase1-demo/src/onos.png
new file mode 100644
index 0000000..afbd438
--- /dev/null
+++ b/odtn-phase1-demo/src/onos.png
Binary files differ
diff --git a/odtn-phase1-demo/src/resources/dcs.js b/odtn-phase1-demo/src/resources/dcs.js
new file mode 100644
index 0000000..c3dd27c
--- /dev/null
+++ b/odtn-phase1-demo/src/resources/dcs.js
@@ -0,0 +1,149 @@
+export function getSips() {
+
+  return new Promise((resolve, reject) => {
+    fetch(`/dcs/operations/tapi-common:get-service-interface-point-list`, {
+      method: 'POST',
+      headers: {
+        "Content-Type": "application/json",
+      },
+      body: "{}"
+    })
+      .then(res => {
+        if (res.ok) {
+          res.json().then(data => resolve(data["tapi-common:output"]["sip"]))
+        } else {
+          reject(res.text())
+        }
+      })
+      .catch(err => {
+        console.error(err)
+      })
+  })
+}
+
+export function getSipDetail(uuid) {
+
+  return new Promise((resolve, reject) => {
+    fetch(`/dcs/data/tapi-common:context/service-interface-point=${uuid}`, {
+      method: 'GET',
+    })
+      .then(res => {
+        if (res.ok) {
+          res.json().then(data => resolve(data["tapi-common:service-interface-point"][0]))
+        } else {
+          reject(res.text())
+        }
+      })
+      .catch(err => {
+        console.error(err)
+      })
+  })
+}
+
+
+export function getConnectivityServices() {
+
+  return new Promise((resolve, reject) => {
+    fetch(`/dcs/operations/tapi-connectivity:get-connectivity-service-list`, {
+      method: 'POST',
+      headers: {
+        "Content-Type": "application/json",
+      },
+      body: '{}'
+    })
+      .then(res => {
+        console.log(res)
+        if (res.ok) {
+          res.json().then(data => resolve(data["tapi-connectivity:output"]["service"]))
+        } else {
+          reject(res.text())
+        }
+      })
+      .catch(err => {
+        console.error(err)
+      })
+  })
+}
+
+
+export function createConnectivityService(sip1, sip2) {
+
+  return new Promise((resolve, reject) => {
+    fetch(`/dcs/operations/tapi-connectivity:create-connectivity-service`, {
+      method: 'POST',
+      headers: {
+        "Content-Type": "application/json",
+      },
+      body: getCreateRequestBody(sip1, sip2)
+    })
+      .then(res => {
+        console.log(res)
+        if (res.ok) {
+          res.json().then(data => resolve(data["tapi-connectivity:output"]["service"]))
+        } else {
+          reject(res.text())
+        }
+      })
+      .catch(err => {
+        console.error(err)
+      })
+  })
+}
+
+
+export function deleteConnectivityServices(uuid) {
+
+  return new Promise((resolve, reject) => {
+    fetch(`/dcs/operations/tapi-connectivity:delete-connectivity-service`, {
+      method: 'POST',
+      headers: {
+        "Content-Type": "application/json",
+      },
+      body: getDeleteRequestBody(uuid)
+    })
+      .then(res => {
+        console.log(res)
+        if (res.ok) {
+          resolve()
+        } else {
+          reject(res.text())
+        }
+      })
+      .catch(err => {
+        console.error(err)
+      })
+  })
+}
+
+
+function getCreateRequestBody(sip1, sip2){
+  return `{
+    "tapi-connectivity:input":
+    {
+        "end-point" : [
+            {
+                "local-id": "id1",
+                "service-interface-point": {
+                    "service-interface-point-uuid" : "${sip1}"
+                }
+            }
+            ,
+            {
+                "local-id": "id2",
+                "service-interface-point": {
+                    "service-interface-point-uuid" : "${sip2}"
+                }
+            }
+        ]
+    }
+}`
+}
+
+function getDeleteRequestBody(uuid){
+  return `{
+    "tapi-connectivity:input":
+    {
+        "service-id-or-name" : "${uuid}"
+    }
+}`
+}
\ No newline at end of file
diff --git a/odtn-phase1-demo/src/resources/getResources.js b/odtn-phase1-demo/src/resources/getResources.js
new file mode 100644
index 0000000..d92b3f2
--- /dev/null
+++ b/odtn-phase1-demo/src/resources/getResources.js
@@ -0,0 +1,54 @@
+import {
+  getConnectivityServices,
+  getSipDetail,
+  getSips,
+} from './dcs'
+import {
+  getDevices,
+  getPorts,
+} from './onos'
+
+
+/**
+ * Provide onos port list along with sip uuid.
+ * @returns {Promise<*[]>}
+ */
+export function getResources() {
+
+  return Promise.all([getDevices(), getSips()])
+    .then(([devices, sips]) => {
+      if(!devices || !sips){
+        throw new Error('Device not found')
+      }
+      const promisePorts = Promise.all(devices.map(device => {
+        return getPorts(device.id)
+      }))
+      const promiseSipDetails = Promise.all(sips.map(sip => {
+        return getSipDetail(sip.uuid)
+      }))
+      return Promise.all([promisePorts, promiseSipDetails, getConnectivityServices()])
+    })
+    .then(([deviceDetails, sipDetails, connectivityService]) => {
+
+      const sipIdMap = sipDetails.reduce((_sipIdMap, sipDetail) => {
+        _sipIdMap[sipDetail.name.filter(kv => kv["value-name"] === "onos-cp")[0].value] = sipDetail.uuid
+        return _sipIdMap
+      }, {})
+      console.log(sipIdMap)
+
+      deviceDetails.forEach(deviceDetail => {
+        deviceDetail.ports.forEach(port => {
+          const key = `${port.element}/${port.port}`
+          if(sipIdMap[key]) {
+            port.sipId = sipIdMap[key]
+          }
+        })
+      })
+
+      return [ deviceDetails || [], connectivityService || [] ]
+    })
+    .catch(err => {
+      console.error(err)
+    })
+
+}
\ No newline at end of file
diff --git a/odtn-phase1-demo/src/resources/onos.js b/odtn-phase1-demo/src/resources/onos.js
new file mode 100644
index 0000000..116a879
--- /dev/null
+++ b/odtn-phase1-demo/src/resources/onos.js
@@ -0,0 +1,37 @@
+export function getDevices() {
+
+  return new Promise((resolve, reject) => {
+    fetch(`/onos/devices`, {
+      method: 'GET',
+    })
+      .then(res => {
+        if (res.ok) {
+          res.json().then(data => resolve(data["devices"]))
+        } else {
+          reject(res.text())
+        }
+      })
+      .catch(err => {
+        console.error(err)
+      })
+  })
+}
+
+export function getPorts(devices) {
+
+  return new Promise((resolve, reject) => {
+    fetch(`/onos/devices/${devices}/ports`, {
+      method: 'GET',
+    })
+      .then(res => {
+        if (res.ok) {
+          res.json().then(data => resolve(data))
+        } else {
+          reject(res.text())
+        }
+      })
+      .catch(err => {
+        console.error(err)
+      })
+  })
+}
diff --git a/odtn-phase1-demo/src/serviceWorker.js b/odtn-phase1-demo/src/serviceWorker.js
new file mode 100644
index 0000000..2283ff9
--- /dev/null
+++ b/odtn-phase1-demo/src/serviceWorker.js
@@ -0,0 +1,135 @@
+// This optional code is used to register a service worker.
+// register() is not called by default.
+
+// This lets the app load faster on subsequent visits in production, and gives
+// it offline capabilities. However, it also means that developers (and users)
+// will only see deployed updates on subsequent visits to a page, after all the
+// existing tabs open on the page have been closed, since previously cached
+// resources are updated in the background.
+
+// To learn more about the benefits of this model and instructions on how to
+// opt-in, read http://bit.ly/CRA-PWA
+
+const isLocalhost = Boolean(
+  window.location.hostname === 'localhost' ||
+    // [::1] is the IPv6 localhost address.
+    window.location.hostname === '[::1]' ||
+    // 127.0.0.1/8 is considered localhost for IPv4.
+    window.location.hostname.match(
+      /^127(?:\.(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}$/
+    )
+);
+
+export function register(config) {
+  if (process.env.NODE_ENV === 'production' && 'serviceWorker' in navigator) {
+    // The URL constructor is available in all browsers that support SW.
+    const publicUrl = new URL(process.env.PUBLIC_URL, window.location.href);
+    if (publicUrl.origin !== window.location.origin) {
+      // Our service worker won't work if PUBLIC_URL is on a different origin
+      // from what our page is served on. This might happen if a CDN is used to
+      // serve assets; see https://github.com/facebook/create-react-app/issues/2374
+      return;
+    }
+
+    window.addEventListener('load', () => {
+      const swUrl = `${process.env.PUBLIC_URL}/service-worker.js`;
+
+      if (isLocalhost) {
+        // This is running on localhost. Let's check if a service worker still exists or not.
+        checkValidServiceWorker(swUrl, config);
+
+        // Add some additional logging to localhost, pointing developers to the
+        // service worker/PWA documentation.
+        navigator.serviceWorker.ready.then(() => {
+          console.log(
+            'This web app is being served cache-first by a service ' +
+              'worker. To learn more, visit http://bit.ly/CRA-PWA'
+          );
+        });
+      } else {
+        // Is not localhost. Just register service worker
+        registerValidSW(swUrl, config);
+      }
+    });
+  }
+}
+
+function registerValidSW(swUrl, config) {
+  navigator.serviceWorker
+    .register(swUrl)
+    .then(registration => {
+      registration.onupdatefound = () => {
+        const installingWorker = registration.installing;
+        if (installingWorker == null) {
+          return;
+        }
+        installingWorker.onstatechange = () => {
+          if (installingWorker.state === 'installed') {
+            if (navigator.serviceWorker.controller) {
+              // At this point, the updated precached content has been fetched,
+              // but the previous service worker will still serve the older
+              // content until all client tabs are closed.
+              console.log(
+                'New content is available and will be used when all ' +
+                  'tabs for this page are closed. See http://bit.ly/CRA-PWA.'
+              );
+
+              // Execute callback
+              if (config && config.onUpdate) {
+                config.onUpdate(registration);
+              }
+            } else {
+              // At this point, everything has been precached.
+              // It's the perfect time to display a
+              // "Content is cached for offline use." message.
+              console.log('Content is cached for offline use.');
+
+              // Execute callback
+              if (config && config.onSuccess) {
+                config.onSuccess(registration);
+              }
+            }
+          }
+        };
+      };
+    })
+    .catch(error => {
+      console.error('Error during service worker registration:', error);
+    });
+}
+
+function checkValidServiceWorker(swUrl, config) {
+  // Check if the service worker can be found. If it can't reload the page.
+  fetch(swUrl)
+    .then(response => {
+      // Ensure service worker exists, and that we really are getting a JS file.
+      const contentType = response.headers.get('content-type');
+      if (
+        response.status === 404 ||
+        (contentType != null && contentType.indexOf('javascript') === -1)
+      ) {
+        // No service worker found. Probably a different app. Reload the page.
+        navigator.serviceWorker.ready.then(registration => {
+          registration.unregister().then(() => {
+            window.location.reload();
+          });
+        });
+      } else {
+        // Service worker found. Proceed as normal.
+        registerValidSW(swUrl, config);
+      }
+    })
+    .catch(() => {
+      console.log(
+        'No internet connection found. App is running in offline mode.'
+      );
+    });
+}
+
+export function unregister() {
+  if ('serviceWorker' in navigator) {
+    navigator.serviceWorker.ready.then(registration => {
+      registration.unregister();
+    });
+  }
+}
diff --git a/odtn-phase1-demo/src/setupProxy.js b/odtn-phase1-demo/src/setupProxy.js
new file mode 100644
index 0000000..b7975b5
--- /dev/null
+++ b/odtn-phase1-demo/src/setupProxy.js
@@ -0,0 +1,27 @@
+const proxy = require('http-proxy-middleware');
+module.exports = function(app) {
+  app.use(proxy('/onos', {
+    "target": "http://localhost:8181/onos/v1",
+    "pathRewrite": {
+      "^/onos": "",
+    },
+    "secure": false,
+    "preserveHeaderKeyCase": true,
+    "headers": {
+      "Authorization": "Basic b25vczpyb2Nrcw=="
+    }
+  }))
+
+  app.use(proxy('/dcs', {
+    "target": "http://localhost:8181/onos/restconf",
+    "pathRewrite": {
+      "^/dcs": "",
+    },
+    "secure": false,
+    "preserveHeaderKeyCase": true,
+    "headers": {
+      "Authorization": "Basic b25vczpyb2Nrcw=="
+    }
+  }))
+
+}
\ No newline at end of file