* @returns {{id: string, source: *, target: *, tenant: *}}
*/
function createLink( linkId, type) {
- var linkIdParts = linkId.split('_');
+ var linkIdParts = linkId.split('++');
return {
'id': linkId,
'source': linkIdParts[1],
});
}
- function getByEpg(epg, successCallback) {
+ function getByEpg(epg, tenant, successCallback) {
/* jshint validthis:true */
var self = this;
var restObj = Restangular.one('restconf').one('operational').one('base-endpoint:endpoints');
return restObj.get().then(function (data) {
- //var endpoints = $filter('filter')(data.endpoints['address-endpoints']['address-endpoint'], {'endpoint-group': epg.id});
- var endpoints = $filter('filter')(data.endpoints['address-endpoints']['address-endpoint'].map(function(endpoint) {
- return endpoint;
- }),
- function(ep) {
- if(ep['endpoint-group'].indexOf(epg.id) != -1)
+ var endpoints = $filter('filter')(
+ data.endpoints['address-endpoints']['address-endpoint'].map(function(endpoint) {
+ return endpoint;
+ }),
+ function (ep) {
+ if (ep.tenant === tenant && ep['endpoint-group'].indexOf(epg.id) !== -1) {
return true;
+ }
}
);
self.setData(endpoints);
* @returns {string}
*/
function generateLinkId(contractId, providerEpgId, consumerEpgId) {
- return contractId + '_' + providerEpgId + '_' + consumerEpgId;
+ return contractId + '++' + providerEpgId + '++' + consumerEpgId;
}
function getContractType(subject) {
function getEndpoints() {
if($scope.sidePanelObject)
- $scope.endpoints.getByEpg($scope.sidePanelObject);
+ $scope.endpoints.getByEpg($scope.sidePanelObject, $scope.rootTenant);
}
$scope.$watch('sidePanelObject', getEndpoints);