Skip to content

Commit

Permalink
lan tag field added to site network access form (#315)
Browse files Browse the repository at this point in the history
  • Loading branch information
soson authored Dec 7, 2021
1 parent 76ddea7 commit d1e5509
Show file tree
Hide file tree
Showing 7 changed files with 31 additions and 11 deletions.
5 changes: 2 additions & 3 deletions packages/frinx-dashboard/src/api/unistore/converters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ import {
EvcAttachmentOutput,
EvcAttachmentInput,
IPConnection,
LanTag,
LocationsOutput,
MaximumRoutes,
ProviderIdentifiers,
Expand Down Expand Up @@ -132,7 +131,7 @@ export function apiRoutingProtocolToClientRoutingProtocol(routingProtocol: Routi
? staticProtocol['cascaded-lan-prefixes']['ipv4-lan-prefixes'].map((p) => {
return {
lan: p.lan,
lanTag: p['lan-tag'] as LanTag,
lanTag: p['lan-tag'] || null,
nextHop: p['next-hop'],
};
})
Expand Down Expand Up @@ -320,7 +319,7 @@ function clientRoutingProtocolsToApiRoutingProtocols(routingProtocols: RoutingPr
'ipv4-lan-prefixes': p.static.map((s) => {
return {
lan: s.lan,
'lan-tag': s.lanTag,
'lan-tag': s.lanTag || undefined,
'next-hop': s.nextHop,
};
}),
Expand Down
3 changes: 1 addition & 2 deletions packages/frinx-dashboard/src/api/unistore/network-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -757,11 +757,10 @@ export enum AccessPriority {
// }
export type RoutingProtocolType = 'bgp' | 'static';
export type VrrpRoutingType = 'ipv4';
export type LanTag = 'lan' | 'lan-tag' | 'next-hop';
export type StaticRoutingType = {
lan: string;
nextHop: string;
lanTag?: LanTag;
lanTag: string | null;
};
export type BgpRoutingType = {
addressFamily: 'ipv4';
Expand Down
5 changes: 2 additions & 3 deletions packages/frinx-gamma/src/components/forms/converters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ import {
ProviderIdentifiers,
RoutingProtocol,
RoutingProtocolType,
LanTag,
IPConnection,
} from './site-types';
import {
Expand Down Expand Up @@ -126,7 +125,7 @@ export function apiRoutingProtocolToClientRoutingProtocol(routingProtocol: Routi
? staticProtocol['cascaded-lan-prefixes']['ipv4-lan-prefixes'].map((p) => {
return {
lan: p.lan,
lanTag: p['lan-tag'] as LanTag,
lanTag: p['lan-tag'] || null,
nextHop: p['next-hop'],
};
})
Expand Down Expand Up @@ -343,7 +342,7 @@ function clientRoutingProtocolsToApiRoutingProtocols(routingProtocols: RoutingPr
'ipv4-lan-prefixes': p.static.map((s) => {
return {
lan: s.lan,
'lan-tag': s.lanTag,
'lan-tag': s.lanTag || undefined,
'next-hop': s.nextHop,
};
}),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,29 @@ const RoutingProtocolForm: VoidFunctionComponent<Props> = ({
/>
</FormControl>

<FormControl id="static-routing-lan-tag" my={6}>
<FormLabel>Static Routing Lan Tag</FormLabel>
<Input
name="static-routing-lan-tag"
value={staticProtocol.static && staticProtocol.static[0].lanTag ? staticProtocol.static[0].lanTag : ''}
onChange={(event) => {
const { value } = event.target;
const [oldStaticRoutingProtocol] = unwrap(staticProtocol.static);
const newStaticProtocol: RoutingProtocol = {
type: 'static',
static: [
{
...oldStaticRoutingProtocol,
lanTag: value || null,
},
],
};
const newProtocols = [bgpProtocol, newStaticProtocol];
onRoutingProtocolsChange(newProtocols);
}}
/>
</FormControl>

<FormControl id="bgp-autonomous-system" my={6}>
<FormLabel>Bgp Autonomous System</FormLabel>
<Input
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ function getDefaultStaticRoutingProtocol(): RoutingProtocol {
{
lan: '',
nextHop: '',
lanTag: null,
},
],
};
Expand Down
3 changes: 1 addition & 2 deletions packages/frinx-gamma/src/components/forms/site-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,10 @@ export type MaximumRoutes = 1000 | 2000 | 5000 | 10000;

export type RoutingProtocolType = 'bgp' | 'static';
export type VrrpRoutingType = 'ipv4';
export type LanTag = 'lan' | 'lan-tag' | 'next-hop';
export type StaticRoutingType = {
lan: string;
nextHop: string;
lanTag?: LanTag;
lanTag: string | null;
};
export type BgpRoutingType = {
addressFamily: 'ipv4';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ const getDefaultNetworkAccess = (): SiteNetworkAccess => ({
},
static: [
{
lanTag: 'lan',
lanTag: '',
lan: '10.0.0.1/0',
nextHop: '10.0.0.3',
},
Expand Down

0 comments on commit d1e5509

Please sign in to comment.